This is a win32-only issue. On windows 64 bits: `(8u * std::mem::size_of::<u32>())` returns 32 `3u >> (8u * std::mem::size_of::<u32>())` returns 3 `3u >> 32u` returns 0 EDIT: IRC found the problem, `uint` is only 32 bits even on Windows 64 bits, which causes undefined behavior. Sorry for wasting your time, closing.