aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crc32defs.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /lib/crc32defs.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'lib/crc32defs.h')
-rw-r--r--lib/crc32defs.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/crc32defs.h b/lib/crc32defs.h
new file mode 100644
index 000000000000..9b6773d73749
--- /dev/null
+++ b/lib/crc32defs.h
@@ -0,0 +1,32 @@
1/*
2 * There are multiple 16-bit CRC polynomials in common use, but this is
3 * *the* standard CRC-32 polynomial, first popularized by Ethernet.
4 * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
5 */
6#define CRCPOLY_LE 0xedb88320
7#define CRCPOLY_BE 0x04c11db7
8
9/* How many bits at a time to use. Requires a table of 4<<CRC_xx_BITS bytes. */
10/* For less performance-sensitive, use 4 */
11#ifndef CRC_LE_BITS
12# define CRC_LE_BITS 8
13#endif
14#ifndef CRC_BE_BITS
15# define CRC_BE_BITS 8
16#endif
17
18/*
19 * Little-endian CRC computation. Used with serial bit streams sent
20 * lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC.
21 */
22#if CRC_LE_BITS > 8 || CRC_LE_BITS < 1 || CRC_LE_BITS & CRC_LE_BITS-1
23# error CRC_LE_BITS must be a power of 2 between 1 and 8
24#endif
25
26/*
27 * Big-endian CRC computation. Used with serial bit streams sent
28 * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC.
29 */
30#if CRC_BE_BITS > 8 || CRC_BE_BITS < 1 || CRC_BE_BITS & CRC_BE_BITS-1
31# error CRC_BE_BITS must be a power of 2 between 1 and 8
32#endif