J'ai un lien qui traine depuis longtemps sur mon PC mais qui je pense peut aider pas mal de programmeurs à optimiser leurs programmes...
http://graphics.stanford.edu/~seander/bithacks.html
Amusez-vous bien, ce site est très intéressant.

Determining if an integer is a power of 2
unsigned int v; // we want to see if v is a power of 2
bool f; // the result goes here
f = (v & (v - 1)) == 0;
Note that 0 is incorrectly considered a power of 2 here. To remedy this, use:
f = !(v & (v - 1)) && v;


Yourk (./13) :
0^x fait bien zéro (pour x>0) non ?
Thepro (./15) :
0^2 = 1 ?
encore lu trop vite, j'ai cru que Yourk demandait x^0 (x>0)Yourk (./13) :
0^x fait bien zéro (pour x>0) non ?
!
>
#if defined(_X_64_)
#define int_size (double)(sizeof(__int64) * 8)
#else
#define int_size (double)(sizeof(int) * 8)
#endif
BOOL is_moumou_right(void)
{
return (pow(2.0, int_size) == 0.0);
(non mais oui, ok
)