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 ac7983a24151184169f9a1977794a4e41b7cc831..d9c4e4917643e2539ac72f8712894cb09ac2c4c0 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 841378d4c587e05ee39993116bcbb0eaa100bab6..6c078a4e682cca11fc4233a3a566dfcb9f721327 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)