third draft: add bitfields to D

Dom DiSc dominikus at scherkl.de
Thu Jul 18 08:52:35 UTC 2024


On Thursday, 18 July 2024 at 00:02:15 UTC, Quirin Schroll wrote:
> The wrong turn on the original `bit` type probably was the idea 
> to be able to point to individual bits.

Why? As pointers are 64bit, the highest three bits will never be 
used anyway (at least not for the next 20 years). Simply shift 
all pointers 3bits to the right and use the lower 3 bits to 
indicate the bitoffset.

So, it's easy to get the adress of a bit: its the byte-adress + 
the bitoffet, so simply all info in the pointer.

In addition make the length also bitlength, so we could define 
2bit or 4bit types without any problem.

In the age of 64bit byte- or word-wise adressing makes no sense 
anymore.



More information about the dip.development mailing list