in reply to [Way OT] C: Arrays of bitfields? (Updated:Please ignore!)
I think you cannot do that in C. But you can use macro to hide the messy expression:
and the appropriate 'set' and 'clr':#define getsextet(UV, I) (( (UV) & ( 0x7f << (6*(I)) ) >> 6*(I))
The sextet have to be cleared before set. I haven't had time to test these macros, please use them carefully.#define clrsextet(UV, I) ( (UV) & ~( 0x7f << (6*(I)) ) #define setsextet(UV, I, S) ( (UV) | ( ((S) & 0x7f) << (6*(I)) )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [Way OT] C: Arrays of bitfields?
by BrowserUk (Patriarch) on Jan 18, 2015 at 09:39 UTC |