diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 16:23:05 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-05 16:23:05 -0400 |
| commit | bac14fa6c79b6abea50fd5f188799ae8e83cb20d (patch) | |
| tree | 416a7b9ff39075ab33fb93ab4e86003df4d25aca /builtins/text.c | |
| parent | 47e8972427c152891c4c6c4b458f78cd7ceb8aee (diff) | |
Fully clean up siphash code and fix some issues
Diffstat (limited to 'builtins/text.c')
| -rw-r--r-- | builtins/text.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/builtins/text.c b/builtins/text.c index 39222ed4..3beda82f 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -74,7 +74,9 @@ #include "text.h" #include "types.h" -#include "siphash.c" +// Use inline version of the siphash code for performance: +#include "siphash.h" +#include "siphash-internals.h" typedef struct { uint32_t main_codepoint; @@ -114,7 +116,7 @@ static bool graphemes_equal(uint32_t **a, uint32_t **b) { static uint64_t grapheme_hash(uint32_t **g) { uint32_t *cluster = *g; - return siphash24((void*)&cluster[1], sizeof(uint32_t[cluster[0]]), (uint64_t*)TOMO_HASH_KEY); + return siphash24((void*)&cluster[1], sizeof(uint32_t[cluster[0]])); } static const TypeInfo GraphemeClusterInfo = { @@ -723,7 +725,7 @@ public uint64_t Text$hash(Text_t *text) { if (text->hash != 0) return text->hash; siphash sh; - siphashinit(&sh, sizeof(int32_t[text->length]), (uint64_t*)TOMO_HASH_KEY); + siphashinit(&sh, sizeof(int32_t[text->length])); union { int32_t chunks[2]; |
