https://github.com/torvalds/linux
Raw File
Tip revision: d566ec94e63702a1bf83f43804b021a8f478a27b authored by dependabot[bot] on 02 November 2023, 21:52:54 UTC
build(deps): bump pip from 23.2.1 to 23.3 in /drivers/gpu/drm/ci/xfails
Tip revision: d566ec9
crc16.h
/* 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 */

back to top