diff --git a/collections/motoko/src/ZhenyaHashmap.mo b/collections/motoko/src/ZhenyaHashmap.mo index 7d2d20e9..4fd82303 100644 --- a/collections/motoko/src/ZhenyaHashmap.mo +++ b/collections/motoko/src/ZhenyaHashmap.mo @@ -5,11 +5,11 @@ import Iter "mo:base/Iter"; import Option "mo:base/Option"; import Random "random"; import Profiling "../../../utils/motoko/Profiling"; - +import Prim "mo:prim"; actor { stable let profiling = Profiling.init(); - - func f_hash(x : Nat64) : Nat32 = Hash.hash(Nat64.toNat x); + + func f_hash(x : Nat64) : Nat32 = Prim.nat64ToNat32(x & 0xffffffff); let hash : HashMap.HashUtils = (f_hash, Nat64.equal); stable var map = HashMap.new(); let rand = Random.new(null, 42); diff --git a/collections/motoko/src/hashmap.mo b/collections/motoko/src/hashmap.mo index 92b70983..f8ae4fc1 100644 --- a/collections/motoko/src/hashmap.mo +++ b/collections/motoko/src/hashmap.mo @@ -9,7 +9,7 @@ import Profiling "../../../utils/motoko/Profiling"; actor { stable let profiling = Profiling.init(); - + func hash(x: Nat64) : Nat32 = Hash.hash(Nat64.toNat x); var map = HashMap.HashMap(0, Nat64.equal, hash); stable var stableMap: [(Nat64, Nat64)] = [];