Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
flashultra committed Dec 14, 2024
1 parent 83a3ae9 commit 4a785f3
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 80 deletions.
24 changes: 12 additions & 12 deletions std/haxe/math/bigint/BigIntArithmetic.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class BigIntArithmetic {
returns 1 if `a > b`; otherwise
returns 0 (`a == b`).
**/
public static function compareInt(a:BigInt_, b:Int):Int {
if (a.m_count > 1) {
return (a.sign() << 1) + 1;
public static function compareInt(a5:BigInt_, b:Int):Int {
if (a5.m_count > 1) {
return (a5.sign() << 1) + 1;
}
var x:Int = a.m_data.get(0);
var x:Int = a5.m_data.get(0);
var lt:Int = (x - b) ^ ((x ^ b) & ((x - b) ^ x)); // "Hacker's Delight" p. 23
var gt:Int = (b - x) ^ ((x ^ b) & ((b - x) ^ b));
return (lt >> 31) | (gt >>> 31);
Expand All @@ -53,30 +53,30 @@ class BigIntArithmetic {
returns 1 if `a > b`; otherwise
returns 0 (`a == b`).
**/
public static function compare(a:BigInt_, b:BigInt_):Int {
if (a != b) {
var c:Int = (a.sign() & 2) + (b.sign() & 1);
public static function compare(a6:BigInt_, b:BigInt_):Int {
if (a6 != b) {
var c:Int = (a6.sign() & 2) + (b.sign() & 1);
switch (c) {
case 0: // a and b are positive
if (a.m_count > b.m_count) {
if (a6.m_count > b.m_count) {
return 1;
}
if (a.m_count < b.m_count) {
if (a6.m_count < b.m_count) {
return -1;
}
case 1: // a is positive, b is negative
return 1;
case 2: // a is negative, b is positive
return -1;
case 3: // a and b are negative
if (a.m_count > b.m_count) {
if (a6.m_count > b.m_count) {
return -1;
}
if (a.m_count < b.m_count) {
if (a6.m_count < b.m_count) {
return 1;
}
}
return MultiwordArithmetic.compareUnsigned(a.m_data, b.m_data, a.m_count);
return MultiwordArithmetic.compareUnsigned(a6.m_data, b.m_data, a6.m_count);
}
return 0;
}
Expand Down
92 changes: 46 additions & 46 deletions std/haxe/math/bigint/BigInt_.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1222,82 +1222,82 @@ class BigInt_ {
}

@:noCompletion
private static inline function equals2Int(a:BigInt_, b:Int):Bool {
return a.equalsInt(b);
private static inline function equals2Int(a15:BigInt_, b:Int):Bool {
return a15.equalsInt(b);
}

@:noCompletion
private static inline function equals2(a:BigInt_, b:BigInt_):Bool {
return a.equals(b);
private static inline function equals2(a16:BigInt_, b:BigInt_):Bool {
return a16.equals(b);
}

@:noCompletion
private static inline function addInt2(a:BigInt_, b:Int):BigInt_ {
private static inline function addInt2(a17:BigInt_, b:Int):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.addInt(r, a, b);
BigIntArithmetic.addInt(r, a17, b);
return r;
}

@:noCompletion
private static inline function add2(a:BigInt_, b:BigInt_):BigInt_ {
private static inline function add2(a18:BigInt_, b:BigInt_):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.add(r, a, b);
BigIntArithmetic.add(r, a18, b);
return r;
}

@:noCompletion
private static inline function subInt2(a:BigInt_, b:Int):BigInt_ {
private static inline function subInt2(a19:BigInt_, b:Int):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.subtractInt(r, a, b);
BigIntArithmetic.subtractInt(r, a19, b);
return r;
}

@:noCompletion
private static inline function sub2(a:BigInt_, b:BigInt_):BigInt_ {
private static inline function sub2(a20:BigInt_, b:BigInt_):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.subtract(r, a, b);
BigIntArithmetic.subtract(r, a20, b);
return r;
}

@:noCompletion
private static inline function multiplyInt2(a:BigInt_, b:Int):BigInt_ {
private static inline function multiplyInt2(a21:BigInt_, b:Int):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.multiplyInt(r, a, b);
BigIntArithmetic.multiplyInt(r, a21, b);
return r;
}

@:noCompletion
private static inline function multiply2(a:BigInt_, b:BigInt_):BigInt_ {
private static inline function multiply2(a22:BigInt_, b:BigInt_):BigInt_ {
var r = new MutableBigInt_();
BigIntArithmetic.multiply(r, a, b);
BigIntArithmetic.multiply(r, a22, b);
return r;
}

@:noCompletion
private static inline function divideInt2(a:BigInt_, b:Int):BigInt_ {
private static inline function divideInt2(a23:BigInt_, b:Int):BigInt_ {
var q = new MutableBigInt_();
BigIntArithmetic.divideInt(a, b, q);
BigIntArithmetic.divideInt(a23, b, q);
return q;
}

@:noCompletion
private static inline function divide2(a:BigInt_, b:BigInt_):BigInt_ {
private static inline function divide2(a24:BigInt_, b:BigInt_):BigInt_ {
var q = new MutableBigInt_();
BigIntArithmetic.divide(a, b, q, null);
BigIntArithmetic.divide(a24, b, q, null);
return q;
}

@:noCompletion
private static inline function modulusInt2(a:BigInt_, b:Int):Int {
private static inline function modulusInt2(a25:BigInt_, b:Int):Int {
var q = new MutableBigInt_();
return BigIntArithmetic.divideInt(a, b, q);
return BigIntArithmetic.divideInt(a25, b, q);
}

@:noCompletion
private static inline function modulus2(a:BigInt_, b:BigInt_):BigInt_ {
private static inline function modulus2(a26:BigInt_, b:BigInt_):BigInt_ {
var q = new MutableBigInt_();
var r = new MutableBigInt_();
BigIntArithmetic.divide(a, b, q, r);
BigIntArithmetic.divide(a26, b, q, r);
return r;
}

Expand All @@ -1316,55 +1316,55 @@ class BigInt_ {
}

@:noCompletion
private static inline function sign1(a:BigInt_):Int {
return a.sign();
private static inline function sign1(a27:BigInt_):Int {
return a27.sign();
}

@:noCompletion
private static inline function isZero1(a:BigInt_):Bool {
return a.isZero();
private static inline function isZero1(a28:BigInt_):Bool {
return a28.isZero();
}

@:noCompletion
private static inline function isNegative1(a:BigInt_):Bool {
return a.isNegative();
private static inline function isNegative1(a29:BigInt_):Bool {
return a29.isNegative();
}

@:noCompletion
private static inline function isPositive1(a:BigInt_):Bool {
return a.isPositive();
private static inline function isPositive1(a30:BigInt_):Bool {
return a30.isPositive();
}

@:noCompletion
private static inline function isOdd1(a:BigInt_):Bool {
return a.isOdd();
private static inline function isOdd1(a31:BigInt_):Bool {
return a31.isOdd();
}

@:noCompletion
private static inline function isEven1(a:BigInt_):Bool {
return a.isEven();
private static inline function isEven1(a32:BigInt_):Bool {
return a32.isEven();
}

@:noCompletion
private static inline function toString1(a:BigInt_, radix:Int):String {
if ((radix == 10 ) || ( radix <2 || radix >36 )) return a.toString();
if (radix == 16 ) return a.toHex();
return a.toBase(radix);
private static inline function toString1(a33:BigInt_, radix:Int):String {
if ((radix == 10 ) || ( radix <2 || radix >36 )) return a33.toString();
if (radix == 16 ) return a33.toHex();
return a33.toBase(radix);
}

@:noCompletion
private static inline function toHex1(a:BigInt_):String {
return a.toHex();
private static inline function toHex1(a34:BigInt_):String {
return a34.toHex();
}

@:noCompletion
private static inline function toBytes1(a:BigInt_):Bytes {
return a.toBytes();
private static inline function toBytes1(a35:BigInt_):Bytes {
return a35.toBytes();
}

@:noCompletion
private static inline function toInts1(a:BigInt_, v:Vector<Int>):Int {
return a.toInts(v);
private static inline function toInts1(a36:BigInt_, v:Vector<Int>):Int {
return a36.toInts(v);
}

static final BitLengthTable:Array<Int> = [
Expand Down
44 changes: 22 additions & 22 deletions std/haxe/math/bigint/MutableBigInt_.hx
Original file line number Diff line number Diff line change
Expand Up @@ -430,55 +430,55 @@ class MutableBigInt_ extends BigInt_ {
}

@:noCompletion
private static inline function multiplyAssignInt2(a:MutableBigInt_, b:Int):Void {
private static inline function multiplyAssignInt2(a7:MutableBigInt_, b:Int):Void {
var r = new MutableBigInt_();
BigIntArithmetic.multiplyInt(r, a, b);
a.copy(r);
BigIntArithmetic.multiplyInt(r, a7, b);
a7.copy(r);
}

@:noCompletion
private static inline function multiplyAssign2(a:MutableBigInt_, b:BigInt_):Void {
private static inline function multiplyAssign2(a8:MutableBigInt_, b:BigInt_):Void {
var r = new MutableBigInt_();
BigIntArithmetic.multiply(r, a, b);
a.copy(r);
BigIntArithmetic.multiply(r, a8, b);
a8.copy(r);
}

@:noCompletion
private static inline function divideAssignInt2(a:MutableBigInt_, b:Int):Void {
private static inline function divideAssignInt2(a9:MutableBigInt_, b:Int):Void {
var q = new MutableBigInt_();
BigIntArithmetic.divideInt(a, b, q);
a.copy(q);
BigIntArithmetic.divideInt(a9, b, q);
a9.copy(q);
}

@:noCompletion
private static inline function divideAssign2(a:MutableBigInt_, b:BigInt_):Void {
private static inline function divideAssign2(a10:MutableBigInt_, b:BigInt_):Void {
var q = new MutableBigInt_();
BigIntArithmetic.divide(a, b, q, null);
a.copy(q);
BigIntArithmetic.divide(a10, b, q, null);
a10.copy(q);
}

@:noCompletion
private static inline function modulusAssignInt2(a:MutableBigInt_, b:Int):Void {
private static inline function modulusAssignInt2(a11:MutableBigInt_, b:Int):Void {
var q = new MutableBigInt_();
var r = BigIntArithmetic.divideInt(a, b, q);
a.setFromInt(r);
var r = BigIntArithmetic.divideInt(a11, b, q);
a11.setFromInt(r);
}

@:noCompletion
private static inline function modulusAssign2(a:MutableBigInt_, b:BigInt_):Void {
private static inline function modulusAssign2(a12:MutableBigInt_, b:BigInt_):Void {
var q = new MutableBigInt_();
var r = new MutableBigInt_();
BigIntArithmetic.divide(a, b, q, r);
a.copy(r);
BigIntArithmetic.divide(a12, b, q, r);
a12.copy(r);
}

@:noCompletion
private static inline function arithmeticShiftLeftAssign2(a:MutableBigInt_, b:Int):Void {
BigIntArithmetic.arithmeticShiftLeft(a, a, b);
private static inline function arithmeticShiftLeftAssign2(a13:MutableBigInt_, b:Int):Void {
BigIntArithmetic.arithmeticShiftLeft(a13, a13, b);
}

@:noCompletion
private static inline function arithmeticShiftRightAssign2(a:MutableBigInt_, b:Int):Void {
BigIntArithmetic.arithmeticShiftRight(a, a, b);
private static inline function arithmeticShiftRightAssign2(a14:MutableBigInt_, b:Int):Void {
BigIntArithmetic.arithmeticShiftRight(a14, a14, b);
}
}

0 comments on commit 4a785f3

Please sign in to comment.