2 ms·
Not C but I used bitfields pretty extensively for the toy 24-bit virtual machine I wrote in D. Internally, it's how I represented registers, bytes and words. Th
by grawprog 7y ago
Not C but I used bitfields pretty extensively for the toy 24-bit virtual machine I wrote in D. Internally, it's how I represented registers, bytes and words. There's only 16MB available for addressing so I wanted individual bits to be accessible. It was the easiest way I found to do that.
- mytailorisrich 7y agoActual bitfields are used extensively. I am obviously talking about the 'bitfield' C feature, which isn't.
- grawprog 7y agoD's are fairly similar to C's bitfields. They're more portable though as far as I know because you can specify the endianness as opposed to C which uses the platform's endianness. Which from what I remember is the main reason C's bitfields are a poor choice for things. Any code isn't portable to architectures with a different endianness.
- mytailorisrich 7y agoYes, we're discussing C's bitfields...