Is there a portable way in C to find out the mask for a bit field at compile time?
Ideally, I'd like to be able to atomically clear a field like this:
struct Reference {
unsigned age : 3;
unsigned marked : 1;
unsigned references : 4;
};
struct Reference myRef;
__sync_and_and_fetch(&myRef, age, ~AGE_MASK);
Otherwise I have to take out a lock on the struct, which is more heavyweight than I'd like.