blob: 322e68dde39e7f8357f8380946aa036ec9c47fba [file] [log] [blame]
Jose R. Santosca2634a2007-10-21 21:03:19 -05001/*
2 * crc16.h - CRC-16 routine
3 *
4 * Implements the standard CRC-16:
5 * Width 16
6 * Poly 0x8005 (x16 + x15 + x2 + 1)
7 * Init 0
8 *
9 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
10 *
11 * This source code is licensed under the GNU General Public License,
12 * Version 2. See the file COPYING for more details.
13 */
14
15#ifndef __CRC16_H
16#define __CRC16_H
17
Jose R. Santosca2634a2007-10-21 21:03:19 -050018/* for an unknown reason, PPC treats __u16 as signed and keeps doing sign
19 * extension on the value. Instead, use only the low 16 bits of an
20 * unsigned int for holding the CRC value to avoid this.
21 */
Theodore Ts'oc4dcb1c2008-08-24 22:44:33 -040022typedef unsigned int crc16_t;
Jose R. Santosca2634a2007-10-21 21:03:19 -050023
Theodore Ts'oc4dcb1c2008-08-24 22:44:33 -040024extern crc16_t ext2fs_crc16(crc16_t crc, const void *buffer, unsigned int len);
Jose R. Santosca2634a2007-10-21 21:03:19 -050025
26#endif /* __CRC16_H */