Skip to content

Commit

Permalink
Fix problem with 8-bit AVR.
Browse files Browse the repository at this point in the history
  • Loading branch information
lasselukkari authored Jan 12, 2021
1 parent b5f04c9 commit 523bc74
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/CardFiles/CardFiles.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ uint32_t calculateHash(const char * string, uint32_t value = 0x811C9DC5) {
};

uint32_t readNumber(uint32_t address) {
uint8_t buf[4];
dataFile.seek(address);
dataFile.read(buf, 4);
return ((buf[0] << 0) & 0xFF) +
((buf[1] << 8) & 0xFFFF) +
((buf[2] << 16) & 0xFFFFFF) +
((buf[3] << 24) & 0xFFFFFFFF);
long four = dataFile.read();
long three = dataFile.read();
long two = dataFile.read();
long one = dataFile.read();

return ((four << 0) & 0xFF) +
((three << 8) & 0xFFFF) +
((two << 16) & 0xFFFFFF) +
((one << 24) & 0xFFFFFFFF);
}

uint32_t lookupTableIndex(const char * key, uint32_t length) {
Expand Down

0 comments on commit 523bc74

Please sign in to comment.