• Home
  • Raw
  • Download

Lines Matching +full:0 +full:x

27     uint32_t res = 0;  in CharToInt()
28 if (c >= '0' && c <= '9') { in CharToInt()
29 res = c - '0'; in CharToInt()
40 ASSERT(conversionToRadix != 0); in Division()
41 uint32_t temp = 0; in Division()
42 remain = 0; in Division()
43 for (size_t i = 0; i < num.size(); i++) { in Division()
48 size_t count = 0; in Division()
49 while (count < num.size() && num[count] == '0') { in Division()
57 ASSERT(conversionToRadix != 0); in Conversion()
60 uint32_t remain = 0; in Conversion()
61 while (newNum.size() != 0) { in Conversion()
71 bigint->SetDigit(0, 0); in GetUint64MaxBigint()
72 bigint->SetDigit(1, 0); in GetUint64MaxBigint()
80 bigint->SetDigit(0, 0); in GetInt64MaxBigint()
81 bigint->SetDigit(1, 0x80000000); // 0x80000000:Int MAX in GetInt64MaxBigint()
87 int flag = 0; in SetBigInt()
88 if (numStr[0] == '-') { in SetBigInt()
103 int index = 0; in SetBigInt()
104 if (mod == 0) { in SetBigInt()
111 uint32_t val = 0; in SetBigInt()
112 for (size_t i = 0; i < mod; ++i) { in SetBigInt()
114 val |= static_cast<uint32_t>(binaryStr[i] - '0'); in SetBigInt()
124 uint32_t val = 0; in SetBigInt()
125 for (size_t j = 0; j < BigInt::DATEBITS && i < binaryStrLen; ++j, ++i) { in SetBigInt()
127 val |= static_cast<uint32_t>(binaryStr[i] - '0'); in SetBigInt()
135 JSHandle<BigInt> BigIntHelper::RightTruncate(JSThread *thread, JSHandle<BigInt> x) in RightTruncate() argument
137 int len = static_cast<int>(x->GetLength()); in RightTruncate()
138 ASSERT(len != 0); in RightTruncate()
139 if (len == 1 && x->GetDigit(0) == 0) { in RightTruncate()
140 x->SetSign(false); in RightTruncate()
141 return x; in RightTruncate()
144 if (x->GetDigit(index) != 0) { in RightTruncate()
145 return x; in RightTruncate()
147 while (index >= 0) { in RightTruncate()
148 if (x->GetDigit(index) != 0) { in RightTruncate()
155 return BigInt::Int32ToBigInt(thread, 0); in RightTruncate()
157 ASSERT(index >= 0); in RightTruncate()
158 return BigInt::Copy(thread, x, index + 1); in RightTruncate()
165 int index = 0; in GetBinary()
168 CString res(strLen, '0'); in GetBinary()
174 res[strIndex--] = (val & 1) + '0'; in GetBinary()
192 bool BigInt::Equal(const JSTaggedValue &x, const JSTaggedValue &y) in Equal() argument
194 BigInt* xVal = BigInt::Cast(x.GetTaggedObject()); in Equal()
199 bool BigInt::Equal(const BigInt *x, const BigInt *y) in Equal() argument
201 ASSERT(x != nullptr); in Equal()
203 if (x->GetSign() != y->GetSign() || x->GetLength() != y->GetLength()) { in Equal()
206 for (uint32_t i = 0; i < x->GetLength(); ++i) { in Equal()
207 if (x->GetDigit(i) != y->GetDigit(i)) { in Equal()
215 bool BigInt::SameValue(const JSTaggedValue &x, const JSTaggedValue &y) in SameValue() argument
217 return Equal(x, y); in SameValue()
221 bool BigInt::SameValueZero(const JSTaggedValue &x, const JSTaggedValue &y) in SameValueZero() argument
223 return Equal(x, y); in SameValueZero()
226 JSHandle<BigInt> BigInt::BitwiseOp(JSThread *thread, Operate op, JSHandle<BigInt> x, JSHandle<BigIn… in BitwiseOp() argument
228 uint32_t maxLen = 0; in BitwiseOp()
229 uint32_t minLen = 0; in BitwiseOp()
230 uint32_t xlen = x->GetLength(); in BitwiseOp()
240 for (size_t i = 0; i < minLen; ++i) { in BitwiseOp()
242 bigint->SetDigit(i, x->GetDigit(i) | y->GetDigit(i)); in BitwiseOp()
244 bigint->SetDigit(i, x->GetDigit(i) & y->GetDigit(i)); in BitwiseOp()
247 bigint->SetDigit(i, x->GetDigit(i) ^ y->GetDigit(i)); in BitwiseOp()
253 bigint->SetDigit(i, x->GetDigit(i)); in BitwiseOp()
264 JSHandle<BigInt> OneIsNegativeAND(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeAND() argument
267 uint32_t xLength = x->GetLength(); in OneIsNegativeAND()
274 uint32_t i = 0; in OneIsNegativeAND()
276 uint32_t res = x->GetDigit(i) & ~(yVal->GetDigit(i)); in OneIsNegativeAND()
281 newBigint->SetDigit(i, x->GetDigit(i)); in OneIsNegativeAND()
287 // 6.1.6.2.20 BigInt::bitwiseAND ( x, y )
288 JSHandle<BigInt> BigInt::BitwiseAND(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseAND() argument
290 if (x->GetSign() && y->GetSign()) { in BitwiseAND()
291 // (-x) & (-y) == -(((x-1) | (y-1)) + 1) in BitwiseAND()
292 JSHandle<BigInt> xVal = BitwiseSubOne(thread, x, x->GetLength()); in BitwiseAND()
298 if (x->GetSign() != y->GetSign()) { in BitwiseAND()
299 // x & (-y) == x & ~(y-1) in BitwiseAND()
300 if (!x->GetSign()) { in BitwiseAND()
301 return OneIsNegativeAND(thread, x, y); in BitwiseAND()
303 return OneIsNegativeAND(thread, y, x); in BitwiseAND()
306 return BitwiseOp(thread, Operate::AND, x, y); in BitwiseAND()
309 JSHandle<BigInt> OneIsNegativeXOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeXOR() argument
312 JSHandle<BigInt> temp = BigInt::BitwiseOp(thread, Operate::XOR, x, yVal); in OneIsNegativeXOR()
317 // 6.1.6.2.21 BigInt::bitwiseOR ( x, y )
318 JSHandle<BigInt> BigInt::BitwiseXOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseXOR() argument
320 if (x->GetSign() && y->GetSign()) { in BitwiseXOR()
321 // (-x) ^ (-y) == (x-1) ^ (y-1) in BitwiseXOR()
322 JSHandle<BigInt> xVal = BitwiseSubOne(thread, x, x->GetLength()); in BitwiseXOR()
326 if (x->GetSign() != y->GetSign()) { in BitwiseXOR()
327 // x ^ (-y) == -((x ^ (y-1)) + 1) in BitwiseXOR()
328 if (!x->GetSign()) { in BitwiseXOR()
329 return OneIsNegativeXOR(thread, x, y); in BitwiseXOR()
331 return OneIsNegativeXOR(thread, y, x); in BitwiseXOR()
334 return BitwiseOp(thread, Operate::XOR, x, y); in BitwiseXOR()
346 for (uint32_t i = 0; i < bigintLen; i++) { in BitwiseSubOne()
347 uint32_t bigintCarry = 0; in BitwiseSubOne()
360 for (uint32_t i = 0; i < bigintLength; i++) { in BitwiseAddOne()
373 for (uint32_t i = 0; i < bigintLength; i++) { in BitwiseAddOne()
374 uint32_t bigintCarry = 0; in BitwiseAddOne()
385 JSHandle<BigInt> OneIsNegativeOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeOR() argument
387 uint32_t xLength = x->GetLength(); in OneIsNegativeOR()
399 uint32_t i = 0; in OneIsNegativeOR()
401 uint32_t res = ~(x->GetDigit(i)) & yVal->GetDigit(i); in OneIsNegativeOR()
415 // 6.1.6.2.22 BigInt::bitwiseOR ( x, y )
416 JSHandle<BigInt> BigInt::BitwiseOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseOR() argument
418 if (x->GetSign() && y->GetSign()) { in BitwiseOR()
419 // (-x) | (-y) == -(((x-1) & (y-1)) + 1) in BitwiseOR()
420 uint32_t maxLen = x->GetLength(); in BitwiseOR()
422 maxLen < yLen ? maxLen = yLen : 0; in BitwiseOR()
423 JSHandle<BigInt> xVal = BitwiseSubOne(thread, x, maxLen); in BitwiseOR()
430 if (x->GetSign() != y->GetSign()) { in BitwiseOR()
431 // x | (-y) == -(((y-1) & ~x) + 1) in BitwiseOR()
432 if (!x->GetSign()) { in BitwiseOR()
433 return OneIsNegativeOR(thread, x, y); in BitwiseOR()
435 return OneIsNegativeOR(thread, y, x); in BitwiseOR()
438 return BitwiseOp(thread, Operate::OR, x, y); in BitwiseOR()
441 // 6.1.6.2.23 BigInt::toString ( x )
467 return Int32ToBigInt(thread, 0).GetTaggedValue(); in NumberToBigInt()
471 uint64_t bits = 0; in NumberToBigInt()
477 …uint64_t integerDigits = ((bits >> base::DOUBLE_SIGNIFICAND_SIZE) & 0x7FF) - base::DOUBLE_EXPONENT… in NumberToBigInt()
481 bigint->SetSign(num < 0); in NumberToBigInt()
485 int leftover = 0; in NumberToBigInt()
487 for (int index = static_cast<int>(mayNeedLen - 1); index >= 0; --index) { in NumberToBigInt()
488 uint32_t doubleNum = 0; in NumberToBigInt()
508 uint32_t value = 0; in Int32ToBigInt()
509 bool sign = number < 0; in Int32ToBigInt()
515 bigint->SetDigit(0, value); in Int32ToBigInt()
523 bigint->SetDigit(0, number); in Uint32ToBigInt()
529 uint64_t value = 0; in Int64ToBigInt()
530 bool sign = number < 0; in Int64ToBigInt()
544 uint32_t lowBits = static_cast<uint32_t>(number & 0xffffffff); in Uint64ToBigInt()
545 uint32_t highBits = static_cast<uint32_t>((number >> DATEBITS) & 0xffffffff); in Uint64ToBigInt()
546 bigint->SetDigit(0, lowBits); in Uint64ToBigInt()
555 uint32_t lowBits = GetDigit(0); in ToUint64()
556 uint32_t highBits = 0; in ToUint64()
600 if (size == 0) { in CreateBigWords()
601 return Uint64ToBigInt(thread, 0); in CreateBigWords()
610 for (uint32_t index = 0; index < size; ++index) { in CreateBigWords()
611 uint32_t lowBits = static_cast<uint32_t>(words[index] & 0xffffffff); in CreateBigWords()
612 uint32_t highBits = static_cast<uint32_t>((words[index] >> DATEBITS) & 0xffffffff); in CreateBigWords()
620 JSHandle<BigInt> BigInt::Add(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Add() argument
622 bool xSignFlag = x->GetSign(); in Add()
624 // x + y == x + y in Add()
625 // -x + -y == -(x + y) in Add()
627 return BigintAdd(thread, x, y, xSignFlag); in Add()
629 // x + -y == x - y == -(y - x) in Add()
630 // -x + y == y - x == -(x - y) in Add()
631 uint32_t xLength = x->GetLength(); in Add()
635 if (subSize > 0) { in Add()
636 return BigintSub(thread, x, y, xSignFlag); in Add()
637 } else if (subSize == 0) { in Add()
638 while (i > 0 && x->GetDigit(i) == y->GetDigit(i)) { in Add()
641 if ((x->GetDigit(i) > y->GetDigit(i))) { in Add()
642 return BigintSub(thread, x, y, xSignFlag); in Add()
644 return BigintSub(thread, y, x, ySignFlag); in Add()
647 return BigintSub(thread, y, x, ySignFlag); in Add()
650 JSHandle<BigInt> BigInt::Subtract(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Subtract() argument
652 bool xSignFlag = x->GetSign(); in Subtract()
655 // x - (-y) == x + y in Subtract()
656 // (-x) - y == -(x + y) in Subtract()
657 return BigintAdd(thread, x, y, xSignFlag); in Subtract()
659 // x - y == -(y - x) in Subtract()
660 // (-x) - (-y) == y - x == -(x - y) in Subtract()
661 uint32_t xLength = x->GetLength(); in Subtract()
665 if (subSize > 0) { in Subtract()
666 return BigintSub(thread, x, y, xSignFlag); in Subtract()
667 } else if (subSize == 0) { in Subtract()
668 while (i > 0 && x->GetDigit(i) == y->GetDigit(i)) { in Subtract()
671 if ((x->GetDigit(i) > y->GetDigit(i))) { in Subtract()
672 return BigintSub(thread, x, y, xSignFlag); in Subtract()
674 return BigintSub(thread, y, x, !ySignFlag); in Subtract()
677 return BigintSub(thread, y, x, !ySignFlag); in Subtract()
681 JSHandle<BigInt> BigInt::BigintAdd(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y, bool r… in BigintAdd() argument
683 if (x->GetLength() < y->GetLength()) { in BigintAdd()
684 return BigintAdd(thread, y, x, resultSign); in BigintAdd()
686 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, x->GetLength() + 1); in BigintAdd()
687 uint32_t bigintCarry = 0; in BigintAdd()
688 uint32_t i = 0; in BigintAdd()
690 uint32_t newBigintCarry = 0; in BigintAdd()
691 uint32_t addPlus = BigIntHelper::AddHelper(x->GetDigit(i), y->GetDigit(i), newBigintCarry); in BigintAdd()
697 while (i < x->GetLength()) { in BigintAdd()
698 uint32_t newBigintCarry = 0; in BigintAdd()
699 uint32_t addPlus = BigIntHelper::AddHelper(x->GetDigit(i), bigintCarry, newBigintCarry); in BigintAdd()
709 inline uint32_t BigIntHelper::AddHelper(uint32_t x, uint32_t y, uint32_t &bigintCarry) in AddHelper() argument
711 uint32_t addPlus = x + y; in AddHelper()
712 if (addPlus < x) { in AddHelper()
718 JSHandle<BigInt> BigInt::BigintSub(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y, bool r… in BigintSub() argument
720 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, x->GetLength()); in BigintSub()
721 uint32_t bigintCarry = 0; in BigintSub()
722 uint32_t i = 0; in BigintSub()
724 uint32_t newBigintCarry = 0; in BigintSub()
725 uint32_t minuSub = BigIntHelper::SubHelper(x->GetDigit(i), y->GetDigit(i), newBigintCarry); in BigintSub()
731 while (i < x->GetLength()) { in BigintSub()
732 uint32_t newBigintCarry = 0; in BigintSub()
733 uint32_t minuSub = BigIntHelper::SubHelper(x->GetDigit(i), bigintCarry, newBigintCarry); in BigintSub()
742 JSHandle<BigInt> BigInt::BigintAddOne(JSThread *thread, JSHandle<BigInt> x) in BigintAddOne() argument
745 return Add(thread, x, temp); in BigintAddOne()
748 JSHandle<BigInt> BigInt::BigintSubOne(JSThread *thread, JSHandle<BigInt> x) in BigintSubOne() argument
751 return Subtract(thread, x, temp); in BigintSubOne()
754 inline uint32_t BigIntHelper::SubHelper(uint32_t x, uint32_t y, uint32_t &bigintCarry) in SubHelper() argument
756 uint32_t minuSub = x - y; in SubHelper()
757 if (minuSub > x) { in SubHelper()
763 ComparisonResult BigInt::Compare(const JSTaggedValue &x, const JSTaggedValue &y) in Compare() argument
765 BigInt* xVal = BigInt::Cast(x.GetTaggedObject()); in Compare()
770 ComparisonResult BigInt::Compare(const BigInt *x, const BigInt *y) in Compare() argument
772 bool xSign = x->GetSign(); in Compare()
777 ComparisonResult compar = AbsolutelyCompare(x, y); in Compare()
784 bool BigInt::LessThan(const JSTaggedValue &x, const JSTaggedValue &y) in LessThan() argument
786 return Compare(x, y) == ComparisonResult::LESS; in LessThan()
789 bool BigInt::LessThan(const BigInt *x, const BigInt *y) in LessThan() argument
791 ASSERT(x != nullptr); in LessThan()
793 return Compare(x, y) == ComparisonResult::LESS; in LessThan()
796 JSHandle<BigInt> BigInt::SignedRightShift(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in SignedRightShift() argument
798 bool xIsNull = x->GetDigit(0); in SignedRightShift()
799 bool yIsNull = y->GetDigit(0); in SignedRightShift()
801 return x; in SignedRightShift()
804 return LeftShiftHelper(thread, x, y); in SignedRightShift()
806 return RightShiftHelper(thread, x, y); in SignedRightShift()
815 return Int32ToBigInt(thread, 0); in ReturnIfRightShiftOverMax()
818 void BigInt::RightShift(JSHandle<BigInt> bigint, JSHandle<BigInt> x, uint32_t digitMove, uint32_t b… in RightShift() argument
820 uint32_t size = x->GetLength(); in RightShift()
821 if (bitsMove == 0) { in RightShift()
823 bigint->SetDigit(i - digitMove, x->GetDigit(i)); in RightShift()
826 uint32_t carry = x->GetDigit(digitMove) >> bitsMove; in RightShift()
828 for (uint32_t i = 0; i < last; i++) { in RightShift()
829 uint32_t value = x->GetDigit(i + digitMove + 1); in RightShift()
837 void BigInt::JudgeRoundDown(JSHandle<BigInt> x, uint32_t digitMove, uint32_t bitsMove, uint32_t &ne… in JudgeRoundDown() argument
841 if (x->GetDigit(digitMove) & stamp) { in JudgeRoundDown()
844 for (uint32_t i = 0; i < digitMove; i++) { in JudgeRoundDown()
845 if (x->GetDigit(i) != 0) { in JudgeRoundDown()
852 if (roundDown && bitsMove == 0) { in JudgeRoundDown()
853 uint32_t highBits = x->GetDigit(x->GetLength() - 1); in JudgeRoundDown()
856 if ((~highBits) == 0) { in JudgeRoundDown()
862 JSHandle<BigInt> BigInt::RightShiftHelper(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in RightShiftHelper() argument
864 bool sign = x->GetSign(); in RightShiftHelper()
865 if (y->GetLength() > 1 || y->GetDigit(0) > MAXBITS) { in RightShiftHelper()
868 uint32_t moveNum = y->GetDigit(0); in RightShiftHelper()
871 if (x->GetLength() <= digitMove) { in RightShiftHelper()
874 uint32_t needLen = x->GetLength() - digitMove; in RightShiftHelper()
879 JudgeRoundDown(x, digitMove, bitsMove, needLen, roundDown); in RightShiftHelper()
883 RightShift(bigint, x, digitMove, bitsMove); in RightShiftHelper()
894 JSHandle<BigInt> BigInt::LeftShift(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in LeftShift() argument
897 return RightShiftHelper(thread, x, y); in LeftShift()
899 return LeftShiftHelper(thread, x, y); in LeftShift()
903 JSHandle<BigInt> BigInt::LeftShiftHelper(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in LeftShiftHelper() argument
906 ASSERT(y->GetDigit(0) <= MAXBITS); in LeftShiftHelper()
907 uint32_t moveNum = y->GetDigit(0); in LeftShiftHelper()
911 uint32_t needLen = digitMove + x->GetLength() + static_cast<uint32_t>(!!bitsMove); in LeftShiftHelper()
914 if (bitsMove == 0) { in LeftShiftHelper()
917 bigint->SetDigit(index, x->GetDigit(index - digitMove)); in LeftShiftHelper()
921 uint32_t carry = 0; in LeftShiftHelper()
922 uint32_t index = 0; in LeftShiftHelper()
923 while (index < x->GetLength()) { in LeftShiftHelper()
924 uint32_t value = x->GetDigit(index); in LeftShiftHelper()
929 if (carry != 0) { in LeftShiftHelper()
934 bigint->SetSign(x->GetSign()); in LeftShiftHelper()
944 JSHandle<BigInt> BigInt::Copy(JSThread *thread, JSHandle<BigInt> x, uint32_t len) in Copy() argument
946 ASSERT(x->GetLength() >= len); in Copy()
948 std::copy(x->GetData(), x->GetData() + len, newBig->GetData()); in Copy()
949 newBig->SetSign(x->GetSign()); in Copy()
953 JSHandle<BigInt> BigInt::UnaryMinus(JSThread *thread, JSHandle<BigInt> x) in UnaryMinus() argument
955 if (x->IsZero()) { in UnaryMinus()
956 return x; in UnaryMinus()
958 JSHandle<BigInt> y = Copy(thread, x, x->GetLength()); in UnaryMinus()
963 // 6.1.6.2.2 BigInt::bitwiseNOT ( x )
964 JSHandle<BigInt> BigInt::BitwiseNOT(JSThread *thread, JSHandle<BigInt> x) in BitwiseNOT() argument
966 // ~(-x) == ~(~(x-1)) == x-1 in BitwiseNOT()
967 // ~x == -x-1 == -(x+1) in BitwiseNOT()
968 JSHandle<BigInt> result = BigintAddOne(thread, x); in BitwiseNOT()
969 if (x->GetSign()) { in BitwiseNOT()
987 uint32_t expValue = exponent->GetDigit(0); in Exponentiate()
991 if (base->GetLength() == 1 && base->GetDigit(0) == 1) { in Exponentiate()
997 if (base->GetLength() == 1 && base->GetDigit(0) == 2) { // 2 : We use fast path processing 2 ^ n in Exponentiate()
1027 std::tuple<uint32_t, uint32_t> BigInt::Mul(uint32_t x, uint32_t y) in Mul() argument
1029 uint32_t lowBitX = x & HALFDATEMASK; in Mul()
1030 uint32_t highBitX = x >> HALFDATEBITS; in Mul()
1039 uint32_t carry = 0; in Mul()
1047 JSHandle<BigInt> BigInt::Multiply(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Multiply() argument
1049 if (x->IsZero()) { in Multiply()
1050 return x; in Multiply()
1055 uint32_t needLength = x->GetLength() + y->GetLength(); in Multiply()
1061 for (uint32_t i = 0; i < x->GetLength(); i++) { in Multiply()
1062 uint32_t xVal = x->GetDigit(i); in Multiply()
1063 … // If the current multiplier is 0, we will skip this round of calculation to improve performance. in Multiply()
1065 if (xVal == 0) { in Multiply()
1068 uint32_t carry = 0; in Multiply()
1069 uint32_t high = 0; in Multiply()
1071 for (uint32_t j = 0; j < y->GetLength(); j++) { in Multiply()
1072 uint32_t currentCarry = 0; in Multiply()
1084 while (carry != 0 || high != 0) { in Multiply()
1087 uint32_t currentCarry = 0; in Multiply()
1089 high = 0; in Multiply()
1097 bigint->SetSign(x->GetSign() != y->GetSign()); in Multiply()
1103 size_t count = 0; in DeZero()
1104 while (count < a.size() && a[count] == '0') { in DeZero()
1108 a = "0"; in DeZero()
1114 ComparisonResult BigInt::AbsolutelyCompare(const BigInt *x, const BigInt *y) in AbsolutelyCompare() argument
1116 uint32_t xLen = x->GetLength(); in AbsolutelyCompare()
1124 for (; index >= 0; --index) { in AbsolutelyCompare()
1125 if (x->GetDigit(index) != y->GetDigit(index)) { in AbsolutelyCompare()
1129 if (index < 0) { in AbsolutelyCompare()
1132 … return x->GetDigit(index) > y->GetDigit(index) ? ComparisonResult::GREAT : ComparisonResult::LESS; in AbsolutelyCompare()
1143 if (leadingZeros != 0) { in DivideAndRemainder()
1185 if (!neeedAddOne && shift == 0) { in FormatLeftShift()
1194 if (shift == 0) { in FormatLeftShift()
1197 uint32_t carry = 0; in FormatLeftShift()
1198 uint32_t index = 0; in FormatLeftShift()
1205 if (carry != 0) { in FormatLeftShift()
1215 RightShift(bigint, bigint, 0, shift); in UnformattedRightShift()
1221 uint32_t lastCarry = 0; in SpecialMultiplyAndSub()
1222 uint32_t lastHigh = 0; in SpecialMultiplyAndSub()
1225 for (uint32_t i = 0; i < len; ++i) { in SpecialMultiplyAndSub()
1227 uint32_t carry = 0; in SpecialMultiplyAndSub()
1228 uint32_t high = 0; in SpecialMultiplyAndSub()
1241 uint32_t lastBorrow = 0; in SpecialMultiplyAndSub()
1242 for (uint32_t i = 0; i < qv->GetLength(); ++i) { in SpecialMultiplyAndSub()
1243 uint32_t borrow = 0; in SpecialMultiplyAndSub()
1250 return lastBorrow > 0; in SpecialMultiplyAndSub()
1255 uint32_t lastCarry = 0; in SpecialAdd()
1256 for (uint32_t i = 0; i < v->GetLength(); ++i) { in SpecialAdd()
1257 uint32_t carry = 0; in SpecialAdd()
1269 uint32_t high = 0; in ImproveAccuracy()
1270 uint32_t low = 0; in ImproveAccuracy()
1304 for (int i = static_cast<int>(quotientLen); i >= 0; --i) { in DivideAndRemainderWithBigintDivisor()
1306 uint32_t r = 0; in DivideAndRemainderWithBigintDivisor()
1342 uint32_t r = 0; in DivideAndRemainderWithUint32Divisor()
1345 for (int i = static_cast<int>(dividend->GetLength()) - 1; i >= 0; --i) { in DivideAndRemainderWithUint32Divisor()
1351 for (int i = static_cast<int>(dividend->GetLength()) - 1; i >= 0; --i) { in DivideAndRemainderWithUint32Divisor()
1360 JSHandle<BigInt> BigInt::Divide(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Divide() argument
1366 // returns 0 if x is less than y in Divide()
1368 bool sign = x->GetSign() != y->GetSign(); in Divide()
1369 ComparisonResult compare = AbsolutelyCompare(*x, *y); in Divide()
1371 return Int32ToBigInt(thread, 0); in Divide()
1378 // if y is 1, return +x or -x in Divide()
1379 if (y->IsUint32() && y->GetDigit(0) == 1) { in Divide()
1380 if (sign == x->GetSign()) { in Divide()
1381 return x; in Divide()
1383 return UnaryMinus(thread, x); in Divide()
1388 quotient.Update(DivideAndRemainderWithUint32Divisor(thread, x, y->GetDigit(0), remainder)); in Divide()
1391 quotient.Update(DivideAndRemainderWithBigintDivisor(thread, x, y, remainder)); in Divide()
1408 if (compare == ComparisonResult::EQUAL || (d->IsUint32() && d->GetDigit(0) == 1)) { in Remainder()
1409 return Int32ToBigInt(thread, 0); in Remainder()
1414 DivideAndRemainderWithUint32Divisor(thread, n, d->GetDigit(0), remainder); in Remainder()
1436 if (bit == 0) { in AsUintN()
1437 return Int32ToBigInt(thread, 0).GetTaggedValue(); in AsUintN()
1451 if (bit == 0) { in AsintN()
1452 return Int32ToBigInt(thread, 0).GetTaggedValue(); in AsintN()
1474 double res = 0; in CalculateNumber()
1486 if ((mantissa >> base::DOUBLE_SIGNIFICAND_SIZE) != 0) { in Rounding()
1487 mantissa = 0; in Rounding()
1499 return JSTaggedNumber(0); in BigIntToNumber()
1510 uint64_t sign = bigintSign ? 1ULL << 63 : 0; // 63 : Set the sign bit of sign to 1 in BigIntToNumber()
1517 uint32_t digit = 0; in BigIntToNumber()
1518 if (index > 0) { in BigIntToNumber()
1529 if (remainMantissaBits > 0 && index >= 0) { in BigIntToNumber()
1536 if (remainMantissaBits > 0) { in BigIntToNumber()
1539 int remainDigitBits = 0; in BigIntToNumber()
1540 if (remainMantissaBits < 0) { in BigIntToNumber()
1553 if ((digit & (temp - 1)) != 0) { in BigIntToNumber()
1556 while (index > 0) { in BigIntToNumber()
1557 if (bigint->GetDigit(index--) != 0) { in BigIntToNumber()
1572 return bigintSign ? 0 : 1; in CompareToBitsLen()
1576 return bigintSign ? 1 : 0; in CompareToBitsLen()
1584 bool numberSign = num < 0; in CompareWithNumber()
1592 uint64_t bits = 0; in CompareWithNumber()
1597 int exponential = (bits >> base::DOUBLE_SIGNIFICAND_SIZE) & 0x7FF; in CompareWithNumber()
1612 if (bigint->IsZero() && num > 0) { in CompareWithNumber()
1616 if (integerDigits < 0) { in CompareWithNumber()
1621 int leadingZeros = 0; in CompareWithNumber()
1623 if (res == 0) { in CompareWithNumber()
1630 int leftover = 0; in CompareWithNumber()
1632 for (int index = static_cast<int>(bigintLen - 1); index >= 0; --index) { in CompareWithNumber()
1633 uint32_t doubleNum = 0; in CompareWithNumber()
1660 if (mantissa != 0) { in CompareWithNumber()
1661 ASSERT(leftover > 0); in CompareWithNumber()