This commit is contained in:
Connor Olding 2012-08-05 20:19:44 -07:00
parent 4e0f09e57f
commit 7774c55dee
3 changed files with 2 additions and 12 deletions

3
args.c
View File

@ -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;

10
crc32.c
View File

@ -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) {

1
main.c
View File

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