Shifting arbitrary number of bits

  • Thread starter Thread starter -IgorC-
  • Start date Start date
I

-IgorC-

Guest
Let's say I have the following expression:

~0ULL >> N

Where N is 8-bit unsigned variable.

What will be the result of this expression execution if N > 64 (i.e. larger than unsigned long long width) ? I know that the behavior is undefined per C++ spec, but I'm interested to know what is the VC++ implementation for this situation. From what I see after running several examples is that it seems that N is treated as N % 64 (i.e. modulo the width of the unsigned long long). Can someone confirm or disprove this claim?


Thanks

Continue reading...
 
Back
Top