T
Tomás Ó hÉilidhe
#define ROTATE_LEFT(a,n)(((a)<<(n)) | (((a) & 0xffffffff)>>(32-(n))))
I've been trying to figure out what this macro is supposed to do. Here it
is written in a more reader-friendly manner:
long unsigned RotateLeft(long unsigned const value,unsigned const places)
{
long unsigned x = (value & 0xffffffff); /* Get lower 32 bits only */
x >>= (32-places); /* Shift it to the right */
long unsigned const x = value << places; /* Shift to the left */
return x | y;
}
If I put 11111111111111111111111111111111 into it for "a" and have 19 for
"n", I get:
x == 11111111111111111111111111111111
(x >>= 32-19) == (x >>= 13) == 00000000000001111111111111111111
y == value << 19 == 11111111111111111110000000000000
I then OR the two of them:
x = 00000000000001111111111111111111
y = 11111111111111111110000000000000
And I'm left with all one's again.
Haven't been able to fathom what it's supposed to do yet...
I've been trying to figure out what this macro is supposed to do. Here it
is written in a more reader-friendly manner:
long unsigned RotateLeft(long unsigned const value,unsigned const places)
{
long unsigned x = (value & 0xffffffff); /* Get lower 32 bits only */
x >>= (32-places); /* Shift it to the right */
long unsigned const x = value << places; /* Shift to the left */
return x | y;
}
If I put 11111111111111111111111111111111 into it for "a" and have 19 for
"n", I get:
x == 11111111111111111111111111111111
(x >>= 32-19) == (x >>= 13) == 00000000000001111111111111111111
y == value << 19 == 11111111111111111110000000000000
I then OR the two of them:
x = 00000000000001111111111111111111
y = 11111111111111111110000000000000
And I'm left with all one's again.
Haven't been able to fathom what it's supposed to do yet...