aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/crc10.c22
-rw-r--r--wsutil/crc10.h2
2 files changed, 8 insertions, 16 deletions
diff --git a/wsutil/crc10.c b/wsutil/crc10.c
index 9f04d93c04..17d6f1a291 100644
--- a/wsutil/crc10.c
+++ b/wsutil/crc10.c
@@ -69,25 +69,17 @@ static const guint16 byte_crc10_table[256] = {
0x021e, 0x002d, 0x004b, 0x0278, 0x0087, 0x02b4, 0x02d2, 0x00e1
};
-/* update the data block's CRC-10 remainder one byte at a time */
-guint16 update_crc10_by_bytes(guint16 crc10, const guint8 *data_blk_ptr,
- int data_blk_size)
+/* Update the data block's CRC-10 remainder one byte at a time */
+guint16
+update_crc10_by_bytes(guint16 crc10_accum, const guint8 *data_blk_ptr,
+ int data_blk_size)
{
register int i;
- guint16 crc10_accum = 0;
for (i = 0; i < data_blk_size; i++) {
- crc10_accum = ((crc10_accum << 8) & 0x3ff)
- ^ byte_crc10_table[( crc10_accum >> 2) & 0xff]
- ^ *data_blk_ptr++;
+ crc10_accum = ((crc10_accum << 8) & 0x3ff)
+ ^ byte_crc10_table[( crc10_accum >> 2) & 0xff]
+ ^ *data_blk_ptr++;
}
- crc10_accum = ((crc10_accum << 8) & 0x3ff)
- ^ byte_crc10_table[( crc10_accum >> 2) & 0xff]
- ^ (crc10>>2);
- crc10_accum = ((crc10_accum << 8) & 0x3ff)
- ^ byte_crc10_table[( crc10_accum >> 2) & 0xff]
- ^ ((crc10<<6) & 0xFF);
-
return crc10_accum;
}
-
diff --git a/wsutil/crc10.h b/wsutil/crc10.h
index 41b631962b..f881f3bda9 100644
--- a/wsutil/crc10.h
+++ b/wsutil/crc10.h
@@ -26,7 +26,7 @@
#include "ws_symbol_export.h"
-/* update the data block's CRC-10 remainder one byte at a time */
+/* Update the data block's CRC-10 remainder one byte at a time */
WS_DLL_PUBLIC guint16 update_crc10_by_bytes(guint16 crc10, const guint8 *data_blk_ptr, int data_blk_size);
#endif /* __CRC10_H__ */