Bitfields

Era Scarecrow rtcvb32 at yahoo.com
Tue May 21 19:14:21 UTC 2019


On Tuesday, 21 May 2019 at 17:16:05 UTC, Russel Winder wrote:
> As far as I can see std.bitmanip only caters for 8, 16, 32, and 
> 64 bit long bitfields.

  I worked on/with bitfields in the past, the limit sizes is more 
or less for natural int types that D supports.

  However this limitation is kinda arbitrary, as for simplicity it 
relies on shifting bits, going larger or any byte size is 
possible depending on what needs to be stored, but ti's the speed 
that really takes a penalty when you aren't using native types or 
you have to do a lot of shifting to get the job done.

  What's the layout of what you need? I'll see if i can't make 
something that would work for you.

  Would be better if you can use a object that breaks the parts 
down and you can actually fully access those parts, then just 
re-store it into the limited space you want for storage, which 
then would be faster than bitfields (although not by much)


More information about the Digitalmars-d-learn mailing list