Bitmasks for nicer APIs

from blog arp242.net, | ↗ original
↗ original
Bitmasks is one of those things where the basic idea is simple to understand: it’s just 0s and 1s being toggled on and off. But actually “having it click” to the point where it’s easy to work with can be a bit trickier. At least, it is (or rather, was) for me 😅 With a bitmask you hide (or “mask”) certain bits of a number, which can be useful for...