summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-07-06 06:18:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-07-06 06:18:50 -0700
commit6bbeecf1542da6ca49d15e2816a3c8969b02aa1a (patch)
treec712cd9ac241912920d02e7820b5bcf6ed5da163 /hash.c
parent6e7c0080cdb160d18c0a83f5f85e92a9b988bb5f (diff)
downloadtxr-6bbeecf1542da6ca49d15e2816a3c8969b02aa1a.tar.gz
txr-6bbeecf1542da6ca49d15e2816a3c8969b02aa1a.tar.bz2
txr-6bbeecf1542da6ca49d15e2816a3c8969b02aa1a.zip
hash: C++ maintenance.
* hash.c (hash_buf): Make size parameter unsigned. This eliminates a signed/unsigned comparison error from the GNU C++ compiler. (equal_hash): Use c_unum to get the buffer length. Should that be negative, c_unum will throw.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index e8b9a593..2a0769fa 100644
--- a/hash.c
+++ b/hash.c
@@ -137,7 +137,7 @@ static u32_t hash_c_str(const wchar_t *str, u32_t seed)
return acc;
}
-static u32_t hash_buf(const mem_t *ptr, cnum size, u32_t seed)
+static u32_t hash_buf(const mem_t *ptr, ucnum size, u32_t seed)
{
const u32_t *buf = coerce(const u32_t *, ptr);
int count = hash_str_limit;
@@ -268,7 +268,7 @@ cnum equal_hash(val obj, int *count, ucnum seed)
+ 32 * (equal_hash(obj->rn.to, count, seed)
& (NUM_MAX / 16))) & NUM_MAX;
case BUF:
- return hash_buf(obj->b.data, c_num(obj->b.len), seed);
+ return hash_buf(obj->b.data, c_unum(obj->b.len), seed);
}
internal_error("unhandled case in equal function");