I have an 8x8 grid containing squares that can be either black (off) or white (on). I'd like to use a single byte as the flags for each row, since a byte contains 8 bits. So for example, if I used the byte 154 for the first row, that translates to the binary 10011010, which means that squares 1, 4, 5, and 7 would be turned on, the others would be turned off.
I've used methods of extracting boolean data from each bit of a byte, but they weren't very efficient (loops suck,) so I was hoping there'd be a better way.
Does anyone have any advice that might make this simpler? Like I said, I plan to have each byte control one row of the 8x8 grid, so I might just use a 64 bit intger for the final number, since I'll need 64 flags anyway, easier than a byte array...maybe.
I've used methods of extracting boolean data from each bit of a byte, but they weren't very efficient (loops suck,) so I was hoping there'd be a better way.
Does anyone have any advice that might make this simpler? Like I said, I plan to have each byte control one row of the 8x8 grid, so I might just use a 64 bit intger for the final number, since I'll need 64 flags anyway, easier than a byte array...maybe.
Comment