crc16: use void * as the argument
authorJens Axboe <axboe@kernel.dk>
Sat, 1 Oct 2011 04:49:30 +0000 (22:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 1 Oct 2011 04:49:30 +0000 (22:49 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
crc/crc16.c
crc/crc16.h

index ac7983a..d9c4e49 100644 (file)
@@ -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;
 }
index 841378d..6c078a4 100644 (file)
@@ -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)