Skip to content

Commit

Permalink
Swap endianness of outputted data
Browse files Browse the repository at this point in the history
Fixes #1.
  • Loading branch information
SuperFromND committed Jul 12, 2023
1 parent b862ba6 commit cc9852b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ void png_to_bytes(char* path) {
// so this dumb solution i came up with maintains two nibbles, A and B, and then adds them together
// and then pushes that result into memory. horrible. terrible. but apparently it works almost
if (gray >= 127) {
if (index%2 == 0) {nibble_a = 0x0F;} else {nibble_b = 0x0F;}
if (index%2 == 0) {nibble_a = 0xF0;} else {nibble_b = 0xF0;}
} else {
if (index%2 == 0) {nibble_a = 0x00;} else {nibble_b = 0x00;}
}

// every other instance of this forloop, we add the two nibbles together here
if (index%2==1) {
uint8_t byte = (nibble_a << 4) | nibble_b;
uint8_t byte = (nibble_a >> 4) | nibble_b;

// more debugging stuff dont worry about this
//printf("%02x", byte);
Expand Down

0 comments on commit cc9852b

Please sign in to comment.