On Tuesday, 21 May 2019 at 17:16:05 UTC, Russel Winder wrote:
Hi,

Has anyone used D to work with arbitrary length bitfields with multiple occurences of a sub-bitfield. I am working with DVB Sections and EIT packets are defined as bitfields with loops in them and the header is 112 bits. The loops are handleable with subfields obviously, assuming you can work out how the bigendian works on the byte sequence.

As far as I can see std.bitmanip only caters for 8, 16, 32, and 64 bit long bitfields.

Never used it myself, but BitArray with careful handling of endianess might fit your task.

https://dlang.org/phobos/std_bitmanip.html#.BitArray.this.2
https://dlang.org/phobos/std_bitmanip.html#.peek
  • Bitfields Russel Winder via Digitalmars-d-learn

Reply via email to