diff options
| author | 2018-04-26 00:36:51 +0530 | |
|---|---|---|
| committer | 2018-04-26 00:36:51 +0530 | |
| commit | 02a2551a1779d3be49ebbf1ed371388e9cf1c5f4 (patch) | |
| tree | e3844cdab1656d8b7ed79d17b762ad0b168d2631 | |
| parent | 3e3427232458b15997f02abba920203f76dd4aed (diff) | |
| download | nnn-02a2551a1779d3be49ebbf1ed371388e9cf1c5f4.tar.gz | |
Use static variables for crc8fast
| -rw-r--r-- | nnn.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -354,13 +354,11 @@ crc8init() static uchar crc8fast(uchar const message[], size_t n) { - uchar data; - uchar remainder = 0; - size_t byte; - + static uchar data, remainder; + static size_t byte; /* 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)); remainder = crc8table[data] ^ (remainder << 8); } |