Browse Source

Use static variables for crc8fast

master
Arun Prakash Jana 7 years ago
parent
commit
02a2551a17
No known key found for this signature in database GPG Key ID: A75979F35C080412
1 changed files with 3 additions and 5 deletions
  1. +3
    -5
      nnn.c

+ 3
- 5
nnn.c View File

@@ -354,13 +354,11 @@ crc8init()
static uchar static uchar
crc8fast(uchar const message[], size_t n) crc8fast(uchar const message[], size_t n)
{ {
uchar data; static uchar data, remainder;
uchar remainder = 0; static size_t byte;
size_t byte;



/* Divide the message by the polynomial, a byte at a time */ /* Divide the message by the polynomial, a byte at a time */
for (byte = 0; byte < n; ++byte) { for (remainder = byte = 0; byte < n; ++byte) {
data = message[byte] ^ (remainder >> (WIDTH - 8)); data = message[byte] ^ (remainder >> (WIDTH - 8));
remainder = crc8table[data] ^ (remainder << 8); remainder = crc8table[data] ^ (remainder << 8);
} }


||||||
x
 
000:0
Loading…
Cancel
Save