From 77a920eac12db696d2893778b75cf83a44df44a3 Mon Sep 17 00:00:00 2001 From: Claudio Russo Date: Wed, 14 Feb 2024 16:44:12 +0000 Subject: [PATCH] avoid boxing (changes baseline) --- collections/motoko/src/ZhenyaHashmap.mo | 2 +- collections/motoko/src/random.mo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/collections/motoko/src/ZhenyaHashmap.mo b/collections/motoko/src/ZhenyaHashmap.mo index 4fd82303..378bab58 100644 --- a/collections/motoko/src/ZhenyaHashmap.mo +++ b/collections/motoko/src/ZhenyaHashmap.mo @@ -9,7 +9,7 @@ import Prim "mo:prim"; actor { stable let profiling = Profiling.init(); - func f_hash(x : Nat64) : Nat32 = Prim.nat64ToNat32(x & 0xffffffff); + func f_hash(x : Nat64) : Nat32 = Hash.hash(Nat64.toNat x); 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/random.mo b/collections/motoko/src/random.mo index 4a4222fb..b966d66e 100644 --- a/collections/motoko/src/random.mo +++ b/collections/motoko/src/random.mo @@ -4,7 +4,7 @@ import Prim "mo:⛔"; module { public class new(size: ?Nat32, seed: Nat64) { - let modulus : Nat64 = 0x7fffffff; + let modulus : Nat64 = 0xfffffff; //0x7fffffff; var state : Nat64 = seed; var ind : Nat32 = 0;