summaryrefslogtreecommitdiff
path: root/include/hashtbl.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-09-23 16:40:03 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-09-23 16:40:03 -0700
commit8571f06061b47471a340e350fdfcd804098637d6 (patch)
treec255ed0e90a4b716e98d6c9b7635bb88b482e212 /include/hashtbl.h
parentf7dbdb2e136db99051b14403a0f29c5155bbf7d8 (diff)
downloadnasm-8571f06061b47471a340e350fdfcd804098637d6.tar.gz
preprocessor: major cleanups; inline text into Tokenpp-inline
Major cleanups of the preprocessor. In particular, the block-allocation of Token is pretty ridiculous since nearly every token requires a text allocation anyway. Change the definition of Token so that only very long tokens (48+ characters on 64-bit systems) need to be stored out of line. If malloc() preserves alignment (XXX: glibc doesn't) then this means that each Token will fit in a cache line. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/hashtbl.h')
-rw-r--r--include/hashtbl.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/hashtbl.h b/include/hashtbl.h
index 4c6cd5e3..e84d5061 100644
--- a/include/hashtbl.h
+++ b/include/hashtbl.h
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 1996-2018 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
@@ -14,7 +14,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -73,6 +73,12 @@ uint64_t crc64b(uint64_t crc, const void *data, size_t len);
uint64_t crc64ib(uint64_t crc, const void *data, size_t len);
#define CRC64_INIT UINT64_C(0xffffffffffffffff)
+static inline uint64_t crc64_byte(uint64_t crc, uint8_t v)
+{
+ extern const uint64_t crc64_tab[256];
+ return crc64_tab[(uint8_t)(v ^ crc)] ^ (crc >> 8);
+}
+
void **hash_find(struct hash_table *head, const char *string,
struct hash_insert *insert);
void **hash_findb(struct hash_table *head, const void *key, size_t keylen,