This blog post shows possible ideas to make std.bitmanip.bitfields more 
complete:
http://potential-lang.org/2010/07/02/quasi-quoting-ascii-art-to-define-data-structures/

An example of the ideas:
struct IntDesc_t {
  ...
  immutable IST : 3 = 0;
  immutable Unused0 : 5 = 0;
  immutable type : 4 = 0b1110;
  immutable Unused1 : 1 = 0b0;
  dpl : 2;
  p : 1;
...

That means allowing the fields to have an optional initialization value. And 
they can be flagged to be immutable too :-) Bit fields that can't change are 
common.

Bye,
bearophile

Reply via email to