Deleted Added
full compact
crc32.c (112212) crc32.c (200420)
1/*
2 * This code implements the AUTODIN II polynomial used by Ethernet,
3 * and can be used to calculate multicast address hash indices.
4 * It assumes that the low order bits will be transmitted first,
5 * and consequently the low byte should be sent first when
6 * the crc computation is finished. The crc should be complemented
7 * before transmission.
8 * The variable corresponding to the macro argument "crc" should
9 * be an unsigned long and should be preset to all ones for Ethernet
10 * use. An error-free packet will leave 0xDEBB20E3 in the crc.
11 * Spencer Garrett <srg@quick.com>
12 */
13
14#include <sys/cdefs.h>
1/*
2 * This code implements the AUTODIN II polynomial used by Ethernet,
3 * and can be used to calculate multicast address hash indices.
4 * It assumes that the low order bits will be transmitted first,
5 * and consequently the low byte should be sent first when
6 * the crc computation is finished. The crc should be complemented
7 * before transmission.
8 * The variable corresponding to the macro argument "crc" should
9 * be an unsigned long and should be preset to all ones for Ethernet
10 * use. An error-free packet will leave 0xDEBB20E3 in the crc.
11 * Spencer Garrett <srg@quick.com>
12 */
13
14#include <sys/cdefs.h>
15__FBSDID("$FreeBSD: head/usr.bin/cksum/crc32.c 112212 2003-03-13 23:32:28Z robert $");
15__FBSDID("$FreeBSD: head/usr.bin/cksum/crc32.c 200420 2009-12-11 23:35:38Z delphij $");
16
17#include <sys/types.h>
18
19#include <stdio.h>
16
17#include <sys/types.h>
18
19#include <stdio.h>
20#include <stdint.h>
21#include <unistd.h>
22
23#include "extern.h"
24
25#define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
26
27/* generated using the AUTODIN II polynomial
28 * x^32 + x^26 + x^23 + x^22 + x^16 +

--- 94 unchanged lines hidden ---
20#include <unistd.h>
21
22#include "extern.h"
23
24#define CRC(crc, ch) (crc = (crc >> 8) ^ crctab[(crc ^ (ch)) & 0xff])
25
26/* generated using the AUTODIN II polynomial
27 * x^32 + x^26 + x^23 + x^22 + x^16 +

--- 94 unchanged lines hidden ---