summaryrefslogtreecommitdiff
path: root/crc
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2011-09-30 22:49:30 -0600
committerJens Axboe <axboe@kernel.dk>2011-09-30 22:49:30 -0600
commit3095ffa9747a679e4f655388c782e4b201047fd3 (patch)
tree75264e3aca47b14fe6516e9cd46a041ac7fd5d8e /crc
parent82fa6b21d98da1341a54f415e43940213b39f18b (diff)
crc16: use void * as the argument
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'crc')
-rw-r--r--crc/crc16.c5
-rw-r--r--crc/crc16.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/crc/crc16.c b/crc/crc16.c
index ac7983a..d9c4e49 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 841378d..6c078a4 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)