I think I\'m going insane with this.
I have a a piece of code that needs to create an (unsigned) integer with N
consequent bits set to 1. To be exact I
Shifting by as many or more bits than in the integer type you're shifting is undefined in C and C++. On x86 and x86_64, the shift amount of the shift instructions is indeed treated modulo 32 (or whatever the operand size is). You however cannot rely on this modulo behaviour to be generated by your compiler from C or C++ >>
/<<
operations unless your compiler explicitly guarantees it in its documentation.