#What are some use cases for @bitReverse

1 messages · Page 1 of 1 (latest)

wintry girder
#

I'm going through ziglings and I got teased about @bitReverse - at first my brain sold me on big/little endians, but then I realized its bits, not bytes. This is an interesting function so i'm interested in some of the cases when this would be useful. Any insights would be much appreciated.

I'm not a greybeard systems/game dev so i'm more or less just curious about some potential cases this would be used.

woven bobcat
#

chip-8 sprites are stored with the left bit as the most significant, but that's the opposite of how i wanted to store the screen contents in memory, so i have to flip the sprite around before putting it on the screen

wintry girder
#

is this specific to a library (x/y origin and the like)?

#

I suppose i'm curious about fundamentally why this would be preferred

woven bobcat
#

you mean why i have the screen laid out that way?

#

cuz i like it better :P

wintry girder
#

thats an acceptable answer 🙂

woven bobcat
#

it means to access a pixel you do

(screen[(64 * y + x) / 8] >> (x % 8)) & 1