From 67d85b3d5cf145a5bf0a1431d6052473b017daa9 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 6 Jun 2013 01:06:54 +0200 Subject: axgetput: Use shifts instead of a silly table to compute bitmask. Signed-off-by: Ralf Baechle --- ax25/axgetput/proto_bin.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ax25') 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; -- cgit v1.2.3