cleanup
This commit is contained in:
parent
4e0f09e57f
commit
7774c55dee
3 changed files with 2 additions and 12 deletions
3
args.c
3
args.c
|
@ -5,9 +5,8 @@
|
||||||
* copy of the license along with this program; see the file LICENSE.
|
* copy of the license along with this program; see the file LICENSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "args.h"
|
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include "args.h"
|
||||||
|
|
||||||
static int argc, argi;
|
static int argc, argi;
|
||||||
static char **argv, *flag;
|
static char **argv, *flag;
|
||||||
|
|
10
crc32.c
10
crc32.c
|
@ -8,13 +8,6 @@
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
|
|
||||||
int crc_big_endian = 0;
|
|
||||||
ulong crc_polynomial = 0x04C11DB7;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
TABLE_SIZE = 0x100
|
|
||||||
};
|
|
||||||
|
|
||||||
ulong crc_reflect(ulong input)
|
ulong crc_reflect(ulong input)
|
||||||
{
|
{
|
||||||
ulong reflected = 0;
|
ulong reflected = 0;
|
||||||
|
@ -27,14 +20,13 @@ ulong crc_reflect(ulong input)
|
||||||
return reflected;
|
return reflected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: test returning array */
|
|
||||||
void crc_fill_table(ulong *table, int big, ulong polynomial)
|
void crc_fill_table(ulong *table, int big, ulong polynomial)
|
||||||
{
|
{
|
||||||
ulong lsb = (big) ? 1 << 31 : 1; /* least significant bit */
|
ulong lsb = (big) ? 1 << 31 : 1; /* least significant bit */
|
||||||
ulong poly = (big) ? polynomial : crc_reflect(polynomial);
|
ulong poly = (big) ? polynomial : crc_reflect(polynomial);
|
||||||
int c, i;
|
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;
|
*table = (big) ? c << 24 : c;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
if (*table & lsb) {
|
if (*table & lsb) {
|
||||||
|
|
1
main.c
1
main.c
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue