digitalmars.D - More for bitfields
- bearophile (15/15) Jul 04 2010 This blog post shows possible ideas to make std.bitmanip.bitfields more ...
- Ellery Newcomer (3/18) Jul 04 2010 How is this different from erlang's bitfields, aside from the
- Andrei Alexandrescu (3/21) Jul 04 2010 Sounds good. Did you have a chance to enter that into bugzilla?
- bearophile (5/6) Jul 04 2010 Done:
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
Jul 04 2010
On 07/04/2010 07:20 AM, bearophile wrote:
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
How is this different from erlang's bitfields, aside from the
mutable/immutable part?
Jul 04 2010
bearophile wrote:
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
Sounds good. Did you have a chance to enter that into bugzilla?
Andrei
Jul 04 2010
Andrei Alexandrescu:Sounds good. Did you have a chance to enter that into bugzilla?Done: http://d.puremagic.com/issues/show_bug.cgi?id=4425 Bye, bearophile
Jul 04 2010









Ellery Newcomer <ellery-newcomer utulsa.edu> 