Rotate Left

  • Thread starter Thread starter Shawn B.
  • Start date Start date
S

Shawn B.

Greetings,

I'm performing a Rotate Left like this:

return ((it << val) | (it >> 32 - val));


The problem is, I can only make it work if "it" is 32-bit or 64-bit. I need
it to work with 8 and 16 bit as well. So, how can I simulate an 8-bit
rotate with a 32-bit value (or 16-bit rotate with 32-bit value)? BTW: This
is a managed C++ project.


Thanks,
Shawn
 
Just be careful about using an unsigned type (not 'int'!)

The rest should work.
 
Back
Top