Merge tag 'fbdev-for-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux-block.git] / include / linux / crc16.h
CommitLineData
40b0b3f8 1/* SPDX-License-Identifier: GPL-2.0-only */
7657ec1f
EP
2/*
3 * crc16.h - CRC-16 routine
4 *
f24ec7f6 5 * Implements the standard CRC-16:
7657ec1f
EP
6 * Width 16
7 * Poly 0x8005 (x^16 + x^15 + x^2 + 1)
8 * Init 0
9 *
7657ec1f 10 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
7657ec1f
EP
11 */
12
13#ifndef __CRC16_H
14#define __CRC16_H
15
16#include <linux/types.h>
17
7657ec1f
EP
18extern u16 const crc16_table[256];
19
20extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
21
22static inline u16 crc16_byte(u16 crc, const u8 data)
23{
24 return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
25}
26
27#endif /* __CRC16_H */
28