I have an ATMega128A application where I need to shift a field of 12 1s through a 40-bit long number, one bit at a time. It seems to me the easiest way to do this would be to use a uint64_t for the 40-bit number, but my compiler doesn’t support anything longer than 32-bits. I could use a uint32_t and a uint8_t, but there’s probably a better way (bit fields in a structure?) so I thought I’d check in here and see what others thought. I’m neither space nor time constrained, so I’m looking for the clearest solution (i.e. easiest to follow when I look at this code again in a few years). Thanks for any tips.
Joined: Tue. Apr 1, 2003
Posts: 485 View posts