Is it possible to do a circular bit shift in c++?
i.e:
10001000 => 00010001 => 00100010 => 01000100
~Inquirer
Is it possible to do a circular bit shift in c++?
i.e:
10001000 => 00010001 => 00100010 => 01000100
~Inquirer
Compilers:
GCC on Red Hat 8.1 (Primary)
GCC on Mac OS X 10.2.4 (Secondary)
Others:
MinGW on XP
I believe there is a "rotate" asm instruction that does this too...Code:char RotateLeft(char Byte) { return (char)((Byte << 1) | (Byte >> 7)); }
Not sure if a C/C++ function does it though.
MagosX.com
Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
not by any standard means, you could write a class to handle binary numbers and do it yourself. Or write a function that does a circular bit shift.
-LC
Asking the right question is sometimes more important than knowing the answer.
Please read the FAQ
C Reference Card (A MUST!)
Pointers and Memory
The Essentials
CString lib