In my C code I've gotten a little obsessed with "automated" bitfields, after discovering that you can use the auto-count trick in an enum to determine how many bits are needed to hold the values.
Is there a better way to do this? I'm curious if anyone else has explored this...