From b88520737b069e2fc43237a5a6f41e02b2449de0 Mon Sep 17 00:00:00 2001 From: "Balos, Cody, J" Date: Tue, 13 Feb 2024 10:53:31 -0800 Subject: [PATCH] use uint64_t for hash seeds --- src/sundials/sundials_hashmap.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sundials/sundials_hashmap.h b/src/sundials/sundials_hashmap.h index d8743ebe73..3da8ae6e02 100644 --- a/src/sundials/sundials_hashmap.h +++ b/src/sundials/sundials_hashmap.h @@ -20,14 +20,15 @@ #ifndef _SUNDIALS_HASHMAP_H #define _SUNDIALS_HASHMAP_H +#include #include #include #include "sundials/sundials_errors.h" #include "sundials/sundials_types.h" -static const unsigned long HASH_PRIME = 14695981039346656037U; -static const unsigned long HASH_OFFSET_BASIS = 1099511628211U; +static const uint64_t HASH_PRIME = 14695981039346656037U; +static const uint64_t HASH_OFFSET_BASIS = 1099511628211U; /* For a nice discussion on popular hashing algorithms see: @@ -36,9 +37,9 @@ static const unsigned long HASH_OFFSET_BASIS = 1099511628211U; This is a 64-bit implementation of the 'a' modification of the Fowler–Noll–Vo hash (i.e., FNV1-a). */ -static unsigned long fnv1a_hash(const char* str) +static uint64_t fnv1a_hash(const char* str) { - unsigned long hash = HASH_OFFSET_BASIS; + uint64_t hash = HASH_OFFSET_BASIS; char c; while ((c = *str++)) { hash = (hash ^ c) * HASH_PRIME; } return hash;