C: Bit mask question
Bas Jacobs
basfriends at gmail.com
Thu Apr 30 11:19:17 UTC 2009
Hi folks,
Consider a control register, which includes flags and bitfields. When
writing such a register you often see constructions like register = flaga |
flagb | flagc; etc. In a library those flags are then defined as #define
flaga (1 << 6) and #define flagb (1 << 13) (for instance). In my library
there is also a definition for a bitfield, which looks something like this:
#define bitfieldA (0x0F << 16) for a 4bit bitfield located at bits 19 .. 16.
Lets say that I want write 0x6 into this field, how do I do this (using the
macro of course)?
Hope someone can help me,
Bas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20090430/8f1d04ce/attachment.html>
More information about the ubuntu-users
mailing list