• Bezier@suppo.fi
    link
    fedilink
    arrow-up
    18
    ·
    edit-2
    8 months ago

    Using more than one bit for true/false isn’t just a microsoft thing, and not really as ridiculous as it sounds. Memory isn’t addessable by bits, but by bytes. You can either:

    • Do it like the example here.
    • Use bitfields: Pack multiple values into the same address, but “waste” more memory and cpu time for keeping track and checking which bit your bool is in. This is mostly useful when the data itself has to be really small.

    Why is it 32bit / 4 bytes instead of one? I assume a byte alignment reason because of some optimization.