P
Patrick
Hi there,
I have a simple problem to solve but somehow I am too stupid to figure
out where is the error.
Basically, I wanna shift each element of the array by an amount of n,
whereas the n highest
bits shifted out should be the n-least significant bits of the next
higher word. I tried doing this
by shifting the words the amount of n to the left which works fine. In
the next step I shift the lower
word 32-n positions to the right and OR the result with the higher
word which should add the then
bits I shifted out in the former step. Here is the code:
uint32 p_lo[] = { 0x00, 0x00, 0x00, 0x00 };
for (j = 0; j < 64; j ++ )
{
p_lo[0] <<= (j % 32);
p_lo[1] <<= (j % 32);
p_lo[1] |= (p_lo[0] >> (32 - (j % 32)));
}
Unfortuantely the outcome is nonsense... Anyone an idea what I am
missing?
Many thanks,
Patrick
I have a simple problem to solve but somehow I am too stupid to figure
out where is the error.
Basically, I wanna shift each element of the array by an amount of n,
whereas the n highest
bits shifted out should be the n-least significant bits of the next
higher word. I tried doing this
by shifting the words the amount of n to the left which works fine. In
the next step I shift the lower
word 32-n positions to the right and OR the result with the higher
word which should add the then
bits I shifted out in the former step. Here is the code:
uint32 p_lo[] = { 0x00, 0x00, 0x00, 0x00 };
for (j = 0; j < 64; j ++ )
{
p_lo[0] <<= (j % 32);
p_lo[1] <<= (j % 32);
p_lo[1] |= (p_lo[0] >> (32 - (j % 32)));
}
Unfortuantely the outcome is nonsense... Anyone an idea what I am
missing?
Many thanks,
Patrick