2 * This was copied from the linux kernel and adjusted for our types.
5 * crc16.h - CRC-16 routine
7 * Implements the standard CRC-16:
9 * Poly 0x8005 (x^16 + x^15 + x^2 + 1)
12 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
14 * This source code is licensed under the GNU General Public License,
15 * Version 2. See the file COPYING for more details.
23 #include <sys/types.h>
25 extern uint16_t const osmo_crc16_table[256];
27 extern uint16_t osmo_crc16(uint16_t crc, const uint8_t *buffer, size_t len);
29 static inline uint16_t osmo_crc16_byte(uint16_t crc, const uint8_t data)
31 return (crc >> 8) ^ osmo_crc16_table[(crc ^ data) & 0xff];
34 #endif /* __CRC16_H */