Yes, because cache optimization is still important. Also useful to keep the size of packets down, to reduce the size of file formats, and anywhere that you use hundreds of thousands of instances of the struct.
polite leftists make more leftists
☞ 🇨🇦 (it’s a bit of a fixer-upper eh) ☜
more leftists make revolution
- 0 Posts
- 6 Comments
Joined 1 year ago
Cake day: March 2nd, 2024
You are not logged in. If you use a Fediverse account that is able to follow users, you can follow this user.
Where do you go to talk about such things? Could be fun to have a retro reversing community.
Only because 6502 has no BIT immediate – only BIT zero page and BIT absolute. But the contemporary z80 and gameboy cpu too have dedicated bit instructions, e.g. BIT c,6 (set z flag to bit 6 of register c).
Unlikely. Most of the time on modern hardware, you’re going to be cache-limited, not cycle-limited. Checking one bit in a register is insanely fast.
Use bit-fields:
struct { bool a : 1; bool b : 1; bool c : 1; //... };
Edit: careful not to use a 1-bit signed int, since the only values are 0 and -1, not 0 and 1. This tripped me up once.
I had internet, I used all those a bunch…