-
bit manipulation
Hi folks,
volatile unsigned *general_pointer;
general_pointer += ((*(some_structure->some_pointer_member)>>8)&0x07F);
I'm stuck on this part of a C code, what is actually being done here? Especially that shift by 8 and the '&0x07F' after the bracket?
Thanks. :confused:
-
The shift and mask would take a value whose binary representation might be as followsand result in what is in blue.
[edit]The shift results in a value, continuing with the above example, such as this.The mask clears bit 7, resulting in this.
-
<QUOTE>
The mask clears bit 7, resulting in this.
Code:
00101001
</QUOTE>
Don't you mean the mask clears bit 8?
-
No, I mean bit 7. (Starting from bit 0.)
-
-
Come to think of it, I should have said that it clears bit 7 on up. (I was thinking in 8-bit bytes.)
-