Use static variables for crc8fast

This commit is contained in:
Arun Prakash Jana 2018-04-26 00:36:51 +05:30
parent 3e34272324
commit 02a2551a17
No known key found for this signature in database
GPG key ID: A75979F35C080412

8
nnn.c
View file

@ -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);
}