Skip to content

Commit

Permalink
I won't never give up, no, never give up, no
Browse files Browse the repository at this point in the history
  • Loading branch information
flashultra committed Dec 22, 2024
1 parent 432a3d1 commit c188704
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion std/haxe/math/bigint/BigInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ abstract BigInt(BigInt_) {
//-----------------------------------------------------------------------
// Private constants
//-----------------------------------------------------------------------
#if !cppia
private static var SMALL_PRIMES_PRODUCT:BigInt = BigInt.fromString("1451887755777639901511587432083070202422614380984889313550570919659315177065956574359078912654149167643992684236991305777574330831666511589145701059710742276692757882915756220901998212975756543223550490431013061082131040808010565293748926901442915057819663730454818359472391642885328171302299245556663073719855");

#end
//-----------------------------------------------------------------------
// Public interface
//-----------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions std/haxe/math/bigint/BigInt_.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c188704

Please sign in to comment.