Browse Source

inline cyclic functions

modern
Connor Olding 7 years ago
parent
commit
a83a836007
  1. 2
      args.c
  2. 8
      crc32.c

2
args.c

@ -15,7 +15,7 @@ nextarg()
return argv[argi];
}
void
static void
args_parse(int argc_, char **argv_,
void flagfn(char, char*()), void plainfn(char*))
{

8
crc32.c

@ -1,6 +1,6 @@
enum { CRC_TABLE_SIZE = 0x100 };
uint32_t
static inline uint32_t
crc_reflect(uint32_t input)
{
uint32_t reflected = 0;
@ -12,7 +12,7 @@ crc_reflect(uint32_t input)
return reflected;
}
void
static inline void
crc_fill_table(uint32_t *table, int big, uint32_t polynomial)
{
uint32_t lsb = (big) ? 1 << 31 : 1; /* least significant bit */
@ -32,14 +32,14 @@ crc_fill_table(uint32_t *table, int big, uint32_t polynomial)
}
}
void
static inline void
crc_be_cycle(uint32_t *table, uint32_t *remainder, char c)
{
uint32_t byte = table[(((*remainder) >> 24) ^ c) & 0xff];
*remainder = (((*remainder) << 8) ^ byte) & 0xFFFFFFFF;
}
void
static inline void
crc_le_cycle(uint32_t *table, uint32_t *remainder, char c)
{
uint32_t byte = table[((*remainder) ^ c) & 0xFF];

Loading…
Cancel
Save