From eeec5ecd1015b68bd07054b659a15243dc796715 Mon Sep 17 00:00:00 2001 From: Christopher Wright <22761542+xtophyr@users.noreply.github.com> Date: Sat, 20 Sep 2025 08:38:40 -0400 Subject: [PATCH] undo this change --- src/crypto/randomx/reciprocal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/crypto/randomx/reciprocal.c b/src/crypto/randomx/reciprocal.c index 4b4e772f..87cda267 100644 --- a/src/crypto/randomx/reciprocal.c +++ b/src/crypto/randomx/reciprocal.c @@ -52,7 +52,10 @@ uint64_t randomx_reciprocal(uint64_t divisor) { uint64_t quotient = p2exp63 / divisor, remainder = p2exp63 % divisor; - unsigned bsr = 64 - __builtin_clzll(divisor); //highest set bit in divisor + unsigned bsr = 0; //highest set bit in divisor + + for (uint64_t bit = divisor; bit > 0; bit >>= 1) + bsr++; for (unsigned shift = 0; shift < bsr; shift++) { if (remainder >= divisor - remainder) {