freebsd-skq/sys/libkern
Marcel Moolenaar ee6bcf1223 Refactor the CRC-32 code to enhance its usability. Move the actual
CRC logic to a new function: crc32_raw() that obtains the initial
CRC value as well as leaves any post-processing to the caller. As
such, it can be used when the initial CRC value is not ~0U or when
the final CRC value does need to be inverted (bitwise). It also
means that crc32_raw() can be called repeatedly when the data is
not available as a single block, such as for scatter/gather lists
and the likes.

Avoid the additional call overhead incured by the refactoring by
moving the implementation off crc32() to sys/systm.h and making it
inlinable. Since crc32_raw() is itself trivial and since it may
be used in loops that iterate over fragments, having it available
for inlining can be beneficial. Hence, move its implementation
to sys/systm.h as well.

Keep the original implementation of crc32() in libkern/crc32.c for
documentation purposes (as a comment of course).

Triggered by: Jose M Rodriguez (josemi at freebsd dot jazztel dot es)
Discussed on: current@
Tested on: amd64, ia64 (BVO having GPT partitions)
Jargon file candidate: BVO = By Virtue Of :-)
2005-04-27 22:26:45 +00:00
..
alpha /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
arm /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
ia64 /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
arc4random.c
ashldi3.c
ashrdi3.c
bcd.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
bcmp.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
bsearch.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
crc32.c Refactor the CRC-32 code to enhance its usability. Move the actual 2005-04-27 22:26:45 +00:00
divdi3.c
ffs.c
ffsl.c
fls.c
flsl.c
fnmatch.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
gets.c We do want to print '\n'/'\r'. 2005-02-03 15:47:30 +00:00
iconv_converter_if.m /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
iconv_xlat16.c
iconv_xlat.c
iconv.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
index.c
inet_ntoa.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
lshrdi3.c
mcount.c Move the kernel-specific logic to adjust frompc from MI to MD. For 2004-08-27 19:42:35 +00:00
moddi3.c
qdivrem.c
qsort_r.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
qsort.c
quad.h
random.c
rindex.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
scanc.c
skpc.c
strcat.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
strcmp.c
strcpy.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
strdup.c
strlcat.c MFlibc: Remove extra closing parenthesis. 2005-02-03 15:51:39 +00:00
strlcpy.c MFlibc: Remove extra closing parenthesis. 2005-02-03 15:51:39 +00:00
strlen.c
strncmp.c /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-07 00:24:33 +00:00
strncpy.c
strsep.c
strspn.c Replace the current strspn() and strcspn() with significantly faster 2005-04-02 18:52:44 +00:00
strtol.c
strtoq.c
strtoul.c
strtouq.c
strvalid.c Because the argument to strvalid() is a size_t, use a size_t to iterate 2005-01-29 13:34:22 +00:00
ucmpdi2.c
udivdi3.c
umoddi3.c