This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bitfields



reg.field1 = val1, reg.field2 = val2;

would then turn into fetch, mask with a combined mask of field1 and
field2, or val1, or val2, store.

You can also do the RMW yourself: declare the register volatile, but not the fields of it, and copy in/out of the register manually.


volatile struct reg x;

...
{
  struct reg mine = x;
  mine.field1 = true;
  mine.field2 = 0;
  mine.field3++;
  x = mine;
}

Is it a completely brain-dead idea?

If I understood it correctly, it would not be standard compliant.


Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]