summaryrefslogtreecommitdiffstats
path: root/call/crc.c
diff options
context:
space:
mode:
authorTerry Dawson VK2KTJ <terry@animats.net>2001-09-12 13:18:43 +0000
committerTerry Dawson VK2KTJ <terry@animats.net>2001-09-12 13:18:43 +0000
commit0eb707fdcf1b87e71bb3a9eaa8472d0b05799a3d (patch)
treeb2db8371470b697e3ae8a19b1e78c7805046f2d2 /call/crc.c
parent628edceba5f1485ef7c4ef30fba93b4c0c0dd955 (diff)
updated libtool, uniformly indented source, corrected small ax25mond Makefile bug
Diffstat (limited to 'call/crc.c')
-rw-r--r--call/crc.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/call/crc.c b/call/crc.c
index 637b0f5..1e74027 100644
--- a/call/crc.c
+++ b/call/crc.c
@@ -8,31 +8,32 @@
*/
static int crcbit[8] = {
- 0x9188,0x48c4,0x2462,0x1231,0x8108,0x4084,0x2042,0x1021
- };
-
-static int bittab[8] = { 128,64,32,16,8,4,2,1 };
+ 0x9188, 0x48c4, 0x2462, 0x1231, 0x8108, 0x4084, 0x2042, 0x1021
+};
+
+static int bittab[8] = { 128, 64, 32, 16, 8, 4, 2, 1 };
static int crctab[256];
void init_crc(void)
{
- int i,j;
-
- for (i = 0; i < 256; i++) {
- crctab[i] = 0;
- for (j = 0; j < 8; j++) {
- if ((bittab[j] & i) != 0) {
- crctab[i] = crctab[i] ^ crcbit[j];
- }
- }
- }
+ int i, j;
+
+ for (i = 0; i < 256; i++) {
+ crctab[i] = 0;
+ for (j = 0; j < 8; j++) {
+ if ((bittab[j] & i) != 0) {
+ crctab[i] = crctab[i] ^ crcbit[j];
+ }
+ }
+ }
}
/* calculate checksum for autobin-protocol */
-unsigned int calc_crc(unsigned char* buf, int n, unsigned crc)
+unsigned int calc_crc(unsigned char *buf, int n, unsigned crc)
{
- while (--n >= 0)
- crc = (crctab[(crc >> 8)] ^ ((crc << 8) | *buf++)) & 0xffff;
- return crc;
+ while (--n >= 0)
+ crc =
+ (crctab[(crc >> 8)] ^ ((crc << 8) | *buf++)) & 0xffff;
+ return crc;
}