Hi Everyone, It looks like test-bitrotate.c is missing test cases. It is missing the 32-bit rotl and rotr of 0-bits.
The 0-bit rotate should tickle undefined behavior. If you want to clear the undefined behavior, then use this code. It is recognized by Clang, GCC, ICC. It will be compiled down to a single instruction on platforms like IA-32. I can find the mailing list messages for a citation, if needed. BITROTATE_INLINE uint32_t rotl32 (uint32_t x, int n) { return ((x << n) | ( x>>(-n&31)); } BITROTATE_INLINE uint32_t rotr32 (uint32_t x, int n) { return ((x >> n) | ( x<<(-n&31)); } Ditto for the other rotates, like rotl64 and rotr64. The 64-bit rotates should use a mask of 63 instead of 31. Jeff