1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * crc16.h - CRC-16 routine
5 * Implements the standard CRC-16:
7 * Poly 0x8005 (x^16 + x^15 + x^2 + 1)
10 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
16 #include <linux/types.h>
18 extern u16
const crc16_table
[256];
20 extern u16
crc16(u16 crc
, const u8
*buffer
, size_t len
);
22 static inline u16
crc16_byte(u16 crc
, const u8 data
)
24 return (crc
>> 8) ^ crc16_table
[(crc
^ data
) & 0xff];
27 #endif /* __CRC16_H */