Archive for 9. January 2007

Re: SourceComment: I am back ;-) and algorithm for PowerOf2
Atul, that's a really nice trick :-). Pushed in your public branch! Regards, Peter
SourceComment: I am back ;-) and algorithm for PowerOf2
Dear all, static bool isPowerOf2 (quint32 size) { while ((size & 0x01) == 0) size >>= 1; return size == 1; } A faster version could be static bool isPowerOf2 (quint32 size) { if( size == 0 ) return false; return (more...)