diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-06-06 01:06:54 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-06-17 17:30:14 +0200 |
commit | 67d85b3d5cf145a5bf0a1431d6052473b017daa9 (patch) | |
tree | ff19d628478a285ee16bc51534a34e2d4d282d69 /ax25/axgetput/proto_bin.c | |
parent | 19c4577a90015f6e05066a861d560f9702ad642d (diff) |
axgetput: Use shifts instead of a silly table to compute bitmask.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25/axgetput/proto_bin.c')
-rw-r--r-- | ax25/axgetput/proto_bin.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c index c69bc87..5d1bde9 100644 --- a/ax25/axgetput/proto_bin.c +++ b/ax25/axgetput/proto_bin.c @@ -11,7 +11,6 @@ #include "util.h" static int crctab[256]; -static int bittab[8] = { 128, 64, 32, 16, 8, 4, 2, 1 }; static int crcbit[8] = { 0x9188, 0x48c4, 0x2462, 0x1231, 0x8108, 0x4084, 0x2042, 0x1021 }; @@ -25,9 +24,8 @@ static int init_crc(void) for (i = 0; i < 256; i++) { crctab[i] = 0; for (j = 0; j < 8; j++) { - if ((bittab[j] & i) != 0) { + if ((i << j) & 0x80) crctab[i] = crctab[i] ^ crcbit[j]; - } } } return 0; |