Algorithms |
23 Dec 2013
Updated: 24 Dec 2013
Rating: 4.64/5
Votes: 7
Popularity: 3.92
Licence: CPOL
Views: 49,772
Bookmarked: 11
Downloaded: 0
Yet another home-made implementation of the floor function
|
C |
9 Aug 2011
Updated: 9 Aug 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 11,740
Bookmarked: 0
Downloaded: 0
What about this, using SSE2 assembly (32 bits):void Zero(void* Buffer, int Count){ char* Cur= (char*)Buffer; char* End= (char*)Buffer + Count; // Clear the initial unaligned bytes while (Cur < End && (Cur - (char*)0) & 0xf) { *Cur++= 0; } // Clear...
|
C# |
16 May 2011
Updated: 16 May 2011
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 4,500
Bookmarked: 0
Downloaded: 0
// A faster solutionreturn (value & mask) == 0;// Where mask == ~ (None | One | Eight)// This constant can be precomputed at compile-time or run-time (like in Alternate 1)
|
|
13 Dec 2011
Updated: 13 Dec 2011
Rating: 1.80/5
Votes: 2
Popularity: 0.54
Licence: CPOL
Views: 7,681
Bookmarked: 0
Downloaded: 0
array= new int[4][] { new int[] { 5, 1, 0, 0, 0 }, new int[] { 6, 2, 0, 1, 0 }, new int[] { 7, 3, 0, 0, 0 }, new int[] { 0, 4, 0, 0, 0 },};1341 keystrokes spared.
|
|
13 Dec 2011
Updated: 13 Dec 2011
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 7,400
Bookmarked: 0
Downloaded: 0
http://msdn.microsoft.com/en-us/library/h5e7chcf.aspx[^]
|
|
17 Jan 2012
Updated: 17 Jan 2012
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 14,992
Bookmarked: 1
Downloaded: 0
You shouldn't rely on methods from the .NET classes (Bitmap::SetPixel, Bitmap::GetPixel, Color::FromArgb) in the inner loop as these are called intensively, million times per image, and their implementation are opaque to you.If their implementation is opaque to the compiler too, no code...
|
|
17 Jan 2012
Updated: 17 Jan 2012
Rating: 5.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 9,933
Bookmarked: 2
Downloaded: 0
You should be delighted by the CORDIC approach to elementary functions computation.http://drdobbs.com/184404244[^]log10(x){ z = 0; for ( i=1; i= 1) x = x - x*2^(-i); z = z - log10(1-2^(-i)); else x = x + x*2^(-i); ...
|
|
18 Jan 2012
Updated: 18 Jan 2012
Rating: 0.00/5
Votes: 0
Popularity: 0.00
Licence: CPOL
Views: 7,620
Bookmarked: 1
Downloaded: 0
A piece of warning, though: the LockBits method is not a transparent one, it does image format conversion before returning a pointer to the bitmap (this is why it has a PixelFormat argument). And conversely, the UnlockBits method converts back to the original format. My best guess is that when...
|
C++ |
9 Nov 2010
Updated: 9 Nov 2010
Rating: 4.00/5
Votes: 1
Popularity: 0.00
Licence: CPOL
Views: 6,821
Bookmarked: 2
Downloaded: 0
// Real solutions of the quadratic equation A x^2 + B x + C = 0// Returns two roots (possibly identical) in increasing order, or nonebool Quadratic(double A, double B, double C, double R[2]){ if (A == 0) { // Linear, impossible or degenerate, cannot find two roots ...
|
Python |
2 Jul 2014
Updated: 2 Jul 2014
Rating: 4.47/5
Votes: 5
Popularity: 3.12
Licence: CPOL
Views: 19,833
Bookmarked: 6
Downloaded: 2
Computation of the Faulhaber polynomials coefficients
|