From c188704123c01594375eb8a13d2579cacbd5d3af Mon Sep 17 00:00:00 2001 From: flashultra Date: Sun, 22 Dec 2024 21:31:16 +0200 Subject: [PATCH] I won't never give up, no, never give up, no --- std/haxe/math/bigint/BigInt.hx | 3 ++- std/haxe/math/bigint/BigInt_.hx | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/std/haxe/math/bigint/BigInt.hx b/std/haxe/math/bigint/BigInt.hx index 8b2cd9db17d..c925db75604 100644 --- a/std/haxe/math/bigint/BigInt.hx +++ b/std/haxe/math/bigint/BigInt.hx @@ -39,8 +39,9 @@ abstract BigInt(BigInt_) { //----------------------------------------------------------------------- // Private constants //----------------------------------------------------------------------- + #if !cppia private static var SMALL_PRIMES_PRODUCT:BigInt = BigInt.fromString("1451887755777639901511587432083070202422614380984889313550570919659315177065956574359078912654149167643992684236991305777574330831666511589145701059710742276692757882915756220901998212975756543223550490431013061082131040808010565293748926901442915057819663730454818359472391642885328171302299245556663073719855"); - + #end //----------------------------------------------------------------------- // Public interface //----------------------------------------------------------------------- diff --git a/std/haxe/math/bigint/BigInt_.hx b/std/haxe/math/bigint/BigInt_.hx index 74ed5a12516..ae55a76561d 100644 --- a/std/haxe/math/bigint/BigInt_.hx +++ b/std/haxe/math/bigint/BigInt_.hx @@ -567,11 +567,13 @@ class BigInt_ { bytes.set(0, bytes.get(0) | (1 << (7 - excessBits))); bytes.set(bytes.length - 1, bytes.get(bytes.length - 1) | 1); r.setFromBigEndianBytesSigned(bytes); + #if !cppia if (bits > 10) { while (!equals2Int(r.gcd(BigInt.SMALL_PRIMES_PRODUCT), 1)) { BigIntArithmetic.addInt(r, r, 2); } } + #end } while (!r.isProbablePrime(tolerance)); if (r.sign() < 0) BigIntArithmetic.negate(r, r);