Blame view

include/linux/crc16.h 622 Bytes
7657ec1fc   Evgeniy Polyakov   [PATCH] lib/crc16...
1
2
3
  /*
   *	crc16.h - CRC-16 routine
   *
f24ec7f6c   Evgeniy Polyakov   [PATCH] crc16: re...
4
   * Implements the standard CRC-16:
7657ec1fc   Evgeniy Polyakov   [PATCH] lib/crc16...
5
6
7
8
   *   Width 16
   *   Poly  0x8005 (x^16 + x^15 + x^2 + 1)
   *   Init  0
   *
7657ec1fc   Evgeniy Polyakov   [PATCH] lib/crc16...
9
10
11
12
13
14
15
16
17
18
   * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
   *
   * This source code is licensed under the GNU General Public License,
   * Version 2. See the file COPYING for more details.
   */
  
  #ifndef __CRC16_H
  #define __CRC16_H
  
  #include <linux/types.h>
7657ec1fc   Evgeniy Polyakov   [PATCH] lib/crc16...
19
20
21
22
23
24
25
26
27
28
  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 */