[M3devel] Modula-3 bitfields
mika at async.caltech.edu
Fri Aug 24 21:28:59 CEST 2012
>to me :). Like, I really started to like how high-level programs look =
>like, esp ones doing various low-level stuff :). I like to think =
>abstract, to write high-level, readable programs. Ones I don't have =
>problems maintaining for prolonged time intervals.
> I don't need anything funny. I just need a way to represent, in a =
>readable manner, standard communication data structures. So I can =
>continue with my trade without C,
>> Here's an example. A PCI Express DLLP is 32 bits of payload followed =
>> a 16-bit CRC. Should I be able to write this as follows:
>> DLLP =3D RECORD
>> payload : BITS 32 FOR [0..16_ffffffff];
>> crc : BITS 16 FOR [0..16_ffff];
>> What then is the layout of=20
>> ARRAY [0..1] OF DLLP;
>Maybe you meant to write: ARRAY [0..1] OF BITS 48 FOR DLLP; ?
And what does that mean, exactly? No gaps allowed? What does it
mean, in particular, on a little-endian machine?
What about ARRAY [0..1] OF BITS 31 FOR [0..16_8fffffff] ?
What I am proposing isn't particularly difficult, it's not unportable,
either. And much more powerful than any sets of pragmas. Not tied to
your one architecture.
More information about the M3devel