Created
September 8, 2011 06:43
-
-
Save erynofwales/1202793 to your computer and use it in GitHub Desktop.
Do bit rotations with bit shifts in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Do bit rotations. x is the data to rotate, c is the number of bits to rotate */ | |
#define ROTATE_R(x,c) (x) = ((x) >> c) | ((x) << (sizeof(x) - c)) | |
#define ROTATE_L(x,c) (x) = ((x) << c) | ((x) >> (sizeof(x) - c)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment