Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_CRC_CCITT_H
0003 #define _LINUX_CRC_CCITT_H
0004 
0005 #include <linux/types.h>
0006 
0007 extern u16 const crc_ccitt_table[256];
0008 extern u16 const crc_ccitt_false_table[256];
0009 
0010 extern u16 crc_ccitt(u16 crc, const u8 *buffer, size_t len);
0011 extern u16 crc_ccitt_false(u16 crc, const u8 *buffer, size_t len);
0012 
0013 static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
0014 {
0015     return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
0016 }
0017 
0018 static inline u16 crc_ccitt_false_byte(u16 crc, const u8 c)
0019 {
0020     return (crc << 8) ^ crc_ccitt_false_table[(crc >> 8) ^ c];
0021 }
0022 
0023 #endif /* _LINUX_CRC_CCITT_H */