Connecting Tech Pros Worldwide Forums | Help | Site Map

Bitmask question

Patrick
Guest
 
Posts: n/a
#1: Jul 19 '07
Hi

I have a basic question concerning rotations and bitmasking.

Assume the following code fragement.

uint32 p_lo[] = { 0x00, 0x00};

for (j = 0; j < 64; j++ )

p_lo[0] <<= (j % 32);

p_lo[1] <<= (j % 32);

p_lo[1] |= (p_hi[0] >(32 - (j % 32)));
}

I itend to do the following. In each iteration shift each element of
the array by an amount of
n. Additionally, the n-bits that are shifted out of each word should
be the least significant bits of the next higher
word. This I try to do by shifting the lower word by 32 - n positions
to the left and OR then the result
with the next higher word. Unfortunately the output does not make
sense.

Has anyone an idea what I am missing?

Many thanks,
Patrick


Patrick
Guest
 
Posts: n/a
#2: Jul 19 '07

re: Bitmask question


Sorry for the multiple posting, I just figured out that there is
something wrong with the google newsgroup interface. Got access
to a newsserver in the meantime!

Cheers,
Patrick
Closed Thread


Similar C / C++ bytes