I\'m having a heck of a time trying to come up with a constant time rotate that does not violate the C/C++ standards.
The problem is the edge/corner cases, where ope
An alternative to the extra modulo is to multiply by 0 or 1 (thanks to !!):
!!
template T rotlMod(T x, unsigned int y) { y %= sizeof(T) * 8; return T((x << y) | (x >> ((!!y) * (sizeof(T) * 8 - y))); }