pull/2/head
Connor Olding 10 years ago
parent 4e0f09e57f
commit 7774c55dee
  1. 3
      args.c
  2. 10
      crc32.c
  3. 1
      main.c

@ -5,9 +5,8 @@
* copy of the license along with this program; see the file LICENSE.
*/
#include "args.h"
#include <stddef.h>
#include "args.h"
static int argc, argi;
static char **argv, *flag;

@ -8,13 +8,6 @@
typedef unsigned long ulong;
#include "crc32.h"
int crc_big_endian = 0;
ulong crc_polynomial = 0x04C11DB7;
enum {
TABLE_SIZE = 0x100
};
ulong crc_reflect(ulong input)
{
ulong reflected = 0;
@ -27,14 +20,13 @@ ulong crc_reflect(ulong input)
return reflected;
}
/* TODO: test returning array */
void crc_fill_table(ulong *table, int big, ulong polynomial)
{
ulong lsb = (big) ? 1 << 31 : 1; /* least significant bit */
ulong poly = (big) ? polynomial : crc_reflect(polynomial);
int c, i;
for (c = 0; c < TABLE_SIZE; c++, table++) {
for (c = 0; c < CRC_TABLE_SIZE; c++, table++) {
*table = (big) ? c << 24 : c;
for (i = 0; i < 8; i++) {
if (*table & lsb) {

@ -7,7 +7,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned long ulong;

Loading…
Cancel
Save