Home | History | Annotate | Download | only in ext2fs
      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 (at) 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 
     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  */
     22 typedef unsigned int crc16_t;
     23 
     24 extern crc16_t ext2fs_crc16(crc16_t crc, const void *buffer, unsigned int len);
     25 
     26 #endif /* __CRC16_H */
     27