On ARM it’s ldrb (load register byte), and on RISC-V it’s lb (load byte).
Every decent compiler will turn booleans into words.
No compiler I know of does this. I think you might be getting confused because they’re loaded into registers which are machine-word sized. But in memory a bool is always one byte.
It’s far more often stored in a word, so 32-64 bytes, depending on the target architecture. At least in most languages.
No it isn’t. All statically typed languages I know of use a byte. Which languages store it in an entire 32 bits? That would be unnecessarily wasteful.
It’s not wasteful, it’s faster. You can’t read one byte, you can only read one word. Every decent compiler will turn booleans into words.
lol what. You can absolutely read one byte: https://godbolt.org/z/TeTch8Yhd
On ARM it’s
ldrb
(load register byte), and on RISC-V it’slb
(load byte).No compiler I know of does this. I think you might be getting confused because they’re loaded into registers which are machine-word sized. But in memory a
bool
is always one byte.Sorry, but you’re very confused here.