mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 03:40:04 +00:00
![Thomas Gleixner](/assets/img/avatar_default.png)
Based on 2 normalized pattern(s): this source code is licensed under the gnu general public license version 2 see the file copying for more details this source code is licensed under general public license version 2 see extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 52 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190602204653.449021192@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 lines
540 B
C
28 lines
540 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* crc16.h - CRC-16 routine
|
|
*
|
|
* Implements the standard CRC-16:
|
|
* Width 16
|
|
* Poly 0x8005 (x^16 + x^15 + x^2 + 1)
|
|
* Init 0
|
|
*
|
|
* Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
|
|
*/
|
|
|
|
#ifndef __CRC16_H
|
|
#define __CRC16_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
extern u16 const crc16_table[256];
|
|
|
|
extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
|
|
|
|
static inline u16 crc16_byte(u16 crc, const u8 data)
|
|
{
|
|
return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
|
|
}
|
|
|
|
#endif /* __CRC16_H */
|
|
|