summaryrefslogtreecommitdiff
path: root/crc64.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-02 17:40:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-02 17:40:00 -0700
commita59795c9860a9a31e6ccf3555ef0e0ca04a0dd87 (patch)
tree608679c4a8021e3e2e28644d1e3059a5e0091e4c /crc64.c
parent17394a7d8e3240c6dafddab7725d953904208e5a (diff)
downloadnasm-a59795c9860a9a31e6ccf3555ef0e0ca04a0dd87.tar.gz
nasm-a59795c9860a9a31e6ccf3555ef0e0ca04a0dd87.tar.bz2
nasm-a59795c9860a9a31e6ccf3555ef0e0ca04a0dd87.zip
Use the crc64 we already use as the perfect hash function prehash
Use the same crc64 that we already use for the symbol table hash as the perfect hash function prehash. We appear to get radically faster convergence this way, and the crc64 is probably *faster*, since the table likely to be resident in memory.
Diffstat (limited to 'crc64.c')
-rw-r--r--crc64.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/crc64.c b/crc64.c
index be9a15b..da41e7d 100644
--- a/crc64.c
+++ b/crc64.c
@@ -132,9 +132,8 @@ static const uint64_t crc64_tab[256] = {
UINT64_C(0x536fa08fdfd90e51), UINT64_C(0x29b7d047efec8728),
};
-uint64_t crc64(const char *str)
+uint64_t crc64(uint64_t crc, const char *str)
{
- uint64_t crc = UINT64_C(0xffffffffffffffff);
uint8_t c;
while ((c = *str++) != 0) {
@@ -144,9 +143,8 @@ uint64_t crc64(const char *str)
return crc;
}
-uint64_t crc64i(const char *str)
+uint64_t crc64i(uint64_t crc, const char *str)
{
- uint64_t crc = UINT64_C(0xffffffffffffffff);
uint8_t c;
while ((c = *str++) != 0) {