From 3095ffa9747a679e4f655388c782e4b201047fd3 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 30 Sep 2011 22:49:30 -0600 Subject: [PATCH] crc16: use void * as the argument Signed-off-by: Jens Axboe --- crc/crc16.c | 5 +++-- crc/crc16.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crc/crc16.c b/crc/crc16.c index ac7983a2..d9c4e491 100644 --- a/crc/crc16.c +++ b/crc/crc16.c @@ -43,11 +43,12 @@ unsigned short const crc16_table[256] = { 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040 }; -unsigned short crc16(unsigned char const *buffer, unsigned int len) +unsigned short crc16(const void *buffer, unsigned int len) { + const unsigned char *cp = (const unsigned char *) buffer; unsigned short crc = 0; while (len--) - crc = crc16_byte(crc, *buffer++); + crc = crc16_byte(crc, *cp++); return crc; } diff --git a/crc/crc16.h b/crc/crc16.h index 841378d4..6c078a4e 100644 --- a/crc/crc16.h +++ b/crc/crc16.h @@ -17,7 +17,7 @@ extern unsigned short const crc16_table[256]; -extern unsigned short crc16(const unsigned char *buffer, unsigned int len); +extern unsigned short crc16(const void *buffer, unsigned int len); static inline unsigned short crc16_byte(unsigned short crc, const unsigned char data) -- 2.25.1