summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-10-06 21:38:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-10-06 21:38:05 -0700
commit1d754f5078370f9855597259d653c1fee2af9991 (patch)
tree5f850640608ef437d42bb4f037af8d1eed4016d3
parent99dde4c70faf86b70ebae8727a0d1f783e4254b3 (diff)
downloadtxr-1d754f5078370f9855597259d653c1fee2af9991.tar.gz
txr-1d754f5078370f9855597259d653c1fee2af9991.tar.bz2
txr-1d754f5078370f9855597259d653c1fee2af9991.zip
hash: bugfix: don't trim seed to 32 bits.
This relates to the November 2021 commit 1d34d767c5dd5fc9d61bc9fda1a7e6a03231cd3d: hash: 64 bit string and buffer hashing and seeds. In the hash constructor, a 32 bit cast was left behind, needlessly reducing the seed value to 32 bits on 64 bit platforms. * hash.c (do_make_hash): Don't convert the ucnum value to u32_t; just store it.
-rw-r--r--hash.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 1a55e0c8..2f99a5ce 100644
--- a/hash.c
+++ b/hash.c
@@ -923,9 +923,8 @@ static val do_make_hash(hash_weak_opt_t wkopt, hash_type_t type, val seed)
val table = vector(mod, nil);
val hash = cobj(coerce(mem_t *, h), hash_cls, &hash_ops);
- h->seed = convert(u32_t, c_unum(default_arg(seed,
- if3(hash_seed_s,
- hash_seed, zero)), self));
+ h->seed = c_unum(default_arg(seed, if3(hash_seed_s, hash_seed, zero)),
+ self);
h->wkopt = wkopt;
h->modulus = c_unum(mod, self);
h->count = 0;