Jose R. Santos | ca2634a | 2007-10-21 21:03:19 -0500 | [diff] [blame] | 1 | /* |
| 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. Santos | ca2634a | 2007-10-21 21:03:19 -0500 | [diff] [blame] | 18 | /* 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'o | c4dcb1c | 2008-08-24 22:44:33 -0400 | [diff] [blame] | 22 | typedef unsigned int crc16_t; |
Jose R. Santos | ca2634a | 2007-10-21 21:03:19 -0500 | [diff] [blame] | 23 | |
Theodore Ts'o | c4dcb1c | 2008-08-24 22:44:33 -0400 | [diff] [blame] | 24 | extern crc16_t ext2fs_crc16(crc16_t crc, const void *buffer, unsigned int len); |
Jose R. Santos | ca2634a | 2007-10-21 21:03:19 -0500 | [diff] [blame] | 25 | |
| 26 | #endif /* __CRC16_H */ |