Inline functions belong in <sys/libkern.h>, not in <sys/systm.h>.

Move crc32() and crc32_raw() from the latter to the former. Move
the declaration of crc32_tab[] to <sys/libkern.h> as well.

Pointed out by: bde@
Tested on: ia64, sparc64
This commit is contained in:
Marcel Moolenaar 2005-04-28 03:19:50 +00:00
parent ff7120cae1
commit db302d160b
2 changed files with 20 additions and 22 deletions

View File

@ -108,6 +108,26 @@ char *strsep(char **, const char *delim);
size_t strspn(const char *, const char *);
int strvalid(const char *, size_t);
extern uint32_t crc32_tab[];
static __inline uint32_t
crc32_raw(const void *buf, size_t size, uint32_t crc)
{
const uint8_t *p = buf;
while (size--)
crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
return (crc);
}
static __inline uint32_t
crc32(const void *buf, size_t size)
{
uint32_t crc;
crc = crc32_raw(buf, size, ~0U);
return (crc ^ ~0U);
}
static __inline int
memcmp(const void *b1, const void *b2, size_t len)

View File

@ -143,28 +143,6 @@ void panic(const char *, ...) __dead2 __printflike(1, 2);
void cpu_boot(int);
void cpu_rootconf(void);
extern uint32_t crc32_tab[];
static __inline uint32_t
crc32_raw(const void *buf, size_t size, uint32_t crc)
{
const uint8_t *p = buf;
while (size--)
crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
return (crc);
}
static __inline uint32_t
crc32(const void *buf, size_t size)
{
uint32_t crc;
crc = crc32_raw(buf, size, ~0U);
return (crc ^ ~0U);
}
void critical_enter(void);
void critical_exit(void);
void init_param1(void);