void SwapInts(int a, int
{
a ^= b;
b ^= a;
a ^= b;
}
Because there are no local variables it is slightly more efficient than 'normal' methods. Anyway, I hope someone has a use for it.
TR
Modifié par the.gray.fox, 05 janvier 2011 - 06:39 .
Modifié par Tarot Redhand, 05 janvier 2011 - 10:32 .
int GetIsPow2 (int nValue)
{
return (nValue & -nValue == nValue);
}
Modifié par the.gray.fox, 11 janvier 2011 - 02:51 .
the.gray.fox wrote...
int GetIsPow2 (int nValue) { return (nValue & -nValue == nValue); }
--------------------
With nValue=8
Bit pattern of +8 is: 00001000
Bit pattern of -8 is: 11111110
-fox
Modifié par the.gray.fox, 12 janvier 2011 - 02:15 .