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
commitd43f7f36d691362ec4b12b26f1ab252d7be280cf (patch)
tree5f850640608ef437d42bb4f037af8d1eed4016d3
parentabe9fad58216f06f5db47c12036cf73521c3c5b5 (diff)
downloadtxr-d43f7f36d691362ec4b12b26f1ab252d7be280cf.tar.gz
txr-d43f7f36d691362ec4b12b26f1ab252d7be280cf.tar.bz2
txr-d43f7f36d691362ec4b12b26f1ab252d7be280cf.zip
hash: bugfix: don't trim seed to 32 bits.
This relates to the November 2021 commit 9108e9f8f4434fb29200b08a4b576df47c407c01: 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;