• Home
  • Raw
  • Download

Lines Matching refs:BigInt

67 JSHandle<BigInt> BigIntHelper::SetBigInt(JSThread *thread, const std::string &numStr, uint32_t curr…  in SetBigInt()
75 if (currentRadix != BigInt::BINARY) { in SetBigInt()
76 binaryStr = Conversion(numStr.substr(flag), BigInt::BINARY, currentRadix); in SetBigInt()
81 JSHandle<BigInt> bigint; in SetBigInt()
83 size_t len = binaryStrLen / BigInt::DATEBITS; in SetBigInt()
84 size_t mod = binaryStrLen % BigInt::DATEBITS; in SetBigInt()
88 bigint = BigInt::CreateBigint(thread, len); in SetBigInt()
92 bigint = BigInt::CreateBigint(thread, len); in SetBigInt()
98 BigInt::SetDigit(thread, bigint, index, val); in SetBigInt()
107 for (size_t j = 0; j < BigInt::DATEBITS && i < binaryStrLen; ++j, ++i) { in SetBigInt()
111 BigInt::SetDigit(thread, bigint, index, val); in SetBigInt()
117 JSHandle<BigInt> BigIntHelper::RightTruncate(JSThread *thread, JSHandle<BigInt> x) in RightTruncate()
147 std::string BigIntHelper::GetBinary(JSHandle<BigInt> bigint) in GetBinary()
151 int strLen = BigInt::DATEBITS * len; in GetBinary()
155 int bityLen = BigInt::DATEBITS; in GetBinary()
177 uint32_t BigInt::GetDigit(uint32_t index) const in GetDigit()
184 void BigInt::SetDigit(JSThread* thread, JSHandle<BigInt> bigint, uint32_t index, uint32_t digit) in SetDigit()
190 uint32_t BigInt::GetLength() const in GetLength()
196 JSHandle<BigInt> BigInt::CreateBigint(JSThread *thread, uint32_t size) in CreateBigint()
200 JSHandle<BigInt> bigint = factory->NewBigInt(); in CreateBigint()
206 bool BigInt::Equal(const JSTaggedValue &x, const JSTaggedValue &y) in Equal()
209 BigInt* xVal = BigInt::Cast(x.GetTaggedObject()); in Equal()
210 BigInt* yVal = BigInt::Cast(y.GetTaggedObject()); in Equal()
214 bool BigInt::Equal(const BigInt *x, const BigInt *y) in Equal()
227 bool BigInt::SameValue(const JSTaggedValue &x, const JSTaggedValue &y) in SameValue()
233 bool BigInt::SameValueZero(const JSTaggedValue &x, const JSTaggedValue &y) in SameValueZero()
239 void BigInt::InitializationZero(JSThread *thread, JSHandle<BigInt> bigint) in InitializationZero()
247 JSHandle<BigInt> BigInt::BitwiseOp(JSThread *thread, Operate op, JSHandle<BigInt> x, JSHandle<BigIn… in BitwiseOp()
260 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, maxLen); in BitwiseOp()
286 JSHandle<BigInt> OneIsNegativeAND(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeAND()
289 JSHandle<BigInt> yVal = BigInt::BigintSubOne(thread, y); in OneIsNegativeAND()
297 JSHandle<BigInt> newBigint = BigInt::CreateBigint(thread, xLength); in OneIsNegativeAND()
301 BigInt::SetDigit(thread, newBigint, i, res); in OneIsNegativeAND()
305 BigInt::SetDigit(thread, newBigint, i, x->GetDigit(i)); in OneIsNegativeAND()
312 JSHandle<BigInt> BigInt::BitwiseAND(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseAND()
318 JSHandle<BigInt> xVal = BigintSubOne(thread, x); in BitwiseAND()
319 JSHandle<BigInt> yVal = BigintSubOne(thread, y); in BitwiseAND()
322 JSHandle<BigInt> temp = BitwiseOp(thread, Operate::OR, xVal, yVal); in BitwiseAND()
323 JSHandle<BigInt> res = BigintAddOne(thread, temp); in BitwiseAND()
338 JSHandle<BigInt> OneIsNegativeXOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeXOR()
341 JSHandle<BigInt> yVal = BigInt::BigintSubOne(thread, y); in OneIsNegativeXOR()
343 JSHandle<BigInt> temp = BigInt::BitwiseOp(thread, Operate::XOR, x, yVal); in OneIsNegativeXOR()
344 JSHandle<BigInt> res = BigInt::BigintAddOne(thread, temp); in OneIsNegativeXOR()
350 JSHandle<BigInt> BigInt::BitwiseXOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseXOR()
356 JSHandle<BigInt> xVal = BigintSubOne(thread, x); in BitwiseXOR()
357 JSHandle<BigInt> yVal = BigintSubOne(thread, y); in BitwiseXOR()
373 JSHandle<BigInt> BigInt::BitwiseSubOne(JSThread *thread, JSHandle<BigInt> bigint, uint32_t maxLen) in BitwiseSubOne()
378 JSHandle<BigInt> newBigint = BigInt::CreateBigint(thread, maxLen); in BitwiseSubOne()
384BigInt::SetDigit(thread, newBigint, i, BigIntHelper::SubHelper(bigint->GetDigit(i), carry, bigintC… in BitwiseSubOne()
389 BigInt::SetDigit(thread, newBigint, i, carry); in BitwiseSubOne()
394 JSHandle<BigInt> BigInt::BitwiseAddOne(JSThread *thread, JSHandle<BigInt> bigint) in BitwiseAddOne()
409 JSHandle<BigInt> newBigint = BigInt::CreateBigint(thread, newLength); in BitwiseAddOne()
414BigInt::SetDigit(thread, newBigint, i, BigIntHelper::AddHelper(bigint->GetDigit(i), carry, bigintC… in BitwiseAddOne()
418 BigInt::SetDigit(thread, newBigint, bigintLength, carry); in BitwiseAddOne()
426 JSHandle<BigInt> OneIsNegativeOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in OneIsNegativeOR()
433 JSHandle<BigInt> yVal = BigInt::BitwiseSubOne(thread, y, maxLen); in OneIsNegativeOR()
439 JSHandle<BigInt> newBigint = BigInt::CreateBigint(thread, yLength); in OneIsNegativeOR()
443 BigInt::SetDigit(thread, newBigint, i, res); in OneIsNegativeOR()
447 BigInt::SetDigit(thread, newBigint, i, yVal->GetDigit(i)); in OneIsNegativeOR()
450 JSHandle<BigInt> temp = BigIntHelper::RightTruncate(thread, newBigint); in OneIsNegativeOR()
451 JSHandle<BigInt> res = BigInt::BitwiseAddOne(thread, temp); in OneIsNegativeOR()
457 JSHandle<BigInt> BigInt::BitwiseOR(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in BitwiseOR()
464 JSHandle<BigInt> xVal = BitwiseSubOne(thread, x, maxLen); in BitwiseOR()
465 JSHandle<BigInt> yVal = BitwiseSubOne(thread, y, yLen); in BitwiseOR()
466 JSHandle<BigInt> temp = BitwiseOp(thread, Operate::AND, xVal, yVal); in BitwiseOR()
467 JSHandle<BigInt> res = BitwiseAddOne(thread, temp); in BitwiseOR()
482 JSHandle<EcmaString> BigInt::ToString(JSThread *thread, JSHandle<BigInt> bigint, uint32_t conversio… in ToString()
487 … BigIntHelper::Conversion(BigIntHelper::GetBinary(bigint), conversionToRadix, BigInt::BINARY); in ToString()
494 std::string BigInt::ToStdString(JSThread *thread, JSHandle<BigInt> bigint, uint32_t conversionToRad… in ToStdString()
497 … BigIntHelper::Conversion(BigIntHelper::GetBinary(bigint), conversionToRadix, BigInt::BINARY); in ToStdString()
504 JSTaggedValue BigInt::NumberToBigInt(JSThread *thread, JSHandle<JSTaggedValue> number) in NumberToBigInt()
523 uint32_t MayNeedLen = integerDigits / BigInt::DATEBITS + 1; in NumberToBigInt()
525 JSHandle<BigInt> bigint = CreateBigint(thread, MayNeedLen); in NumberToBigInt()
536 leftover = mantissaSize - (integerDigits % BigInt::DATEBITS); in NumberToBigInt()
539 BigInt::SetDigit(thread, bigint, index, doubleNum); in NumberToBigInt()
541 leftover -= BigInt::DATEBITS; in NumberToBigInt()
542 doubleNum = static_cast<uint32_t>(mantissa >> BigInt::DATEBITS); in NumberToBigInt()
543 mantissa = mantissa << BigInt::DATEBITS; in NumberToBigInt()
544 BigInt::SetDigit(thread, bigint, index, doubleNum); in NumberToBigInt()
550 JSHandle<BigInt> BigInt::Int32ToBigInt(JSThread *thread, const int &number) in Int32ToBigInt()
555 JSHandle<BigInt> BigInt::Int64ToBigInt(JSThread *thread, const int64_t &number) in Int64ToBigInt()
560 JSHandle<BigInt> BigInt::Uint64ToBigInt(JSThread *thread, const uint64_t &number) in Uint64ToBigInt()
565 void BigInt::BigIntToInt64(JSThread *thread, JSHandle<JSTaggedValue> bigint, int64_t *cValue, bool … in BigIntToInt64()
570 JSHandle<BigInt> bigInt64(thread, JSTaggedValue::ToBigInt64(thread, bigint)); in BigIntToInt64()
584 void BigInt::BigIntToUint64(JSThread *thread, JSHandle<JSTaggedValue> bigint, uint64_t *cValue, boo… in BigIntToUint64()
589 JSHandle<BigInt> bigUint64(thread, JSTaggedValue::ToBigUint64(thread, bigint)); in BigIntToUint64()
600 JSHandle<BigInt> BigInt::CreateBigWords(JSThread *thread, bool sign, uint32_t size, const uint64_t*… in CreateBigWords()
603 JSHandle<BigInt> bigint = CreateBigint(thread, needLen); in CreateBigWords()
612 JSHandle<BigInt> BigInt::Add(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Add()
642 JSHandle<BigInt> BigInt::Subtract(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Subtract()
673 JSHandle<BigInt> BigInt::BigintAdd(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y, bool r… in BigintAdd()
678 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, x->GetLength() + 1); in BigintAdd()
710 JSHandle<BigInt> BigInt::BigintSub(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y, bool r… in BigintSub()
712 JSHandle<BigInt> bigint = BigInt::CreateBigint(thread, x->GetLength()); in BigintSub()
734 JSHandle<BigInt> BigInt::BigintAddOne(JSThread *thread, JSHandle<BigInt> x) in BigintAddOne()
736 JSHandle<BigInt> temp = Int32ToBigInt(thread, 1); in BigintAddOne()
740 JSHandle<BigInt> BigInt::BigintSubOne(JSThread *thread, JSHandle<BigInt> x) in BigintSubOne()
742 JSHandle<BigInt> temp = Int32ToBigInt(thread, 1); in BigintSubOne()
755 ComparisonResult BigInt::Compare(JSThread *thread, const JSTaggedValue &x, const JSTaggedValue &y) in Compare()
766 bool BigInt::LessThan(const JSTaggedValue &x, const JSTaggedValue &y) in LessThan()
768 BigInt* xVal = BigInt::Cast(x.GetTaggedObject()); in LessThan()
769 BigInt* yVal = BigInt::Cast(y.GetTaggedObject()); in LessThan()
773 bool BigInt::LessThan(const BigInt *x, const BigInt *y) in LessThan()
801 JSHandle<BigInt> BigInt::SignedRightShift(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in SignedRightShift()
815 JSHandle<BigInt> BigInt::RightShiftHelper(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in RightShiftHelper()
826 JSHandle<BigInt> bigint = BigIntHelper::SetBigInt(thread, finalBinay, BINARY); in RightShiftHelper()
834 JSHandle<BigInt> BigInt::LeftShift(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in LeftShift()
843 JSHandle<BigInt> BigInt::LeftShiftHelper(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in LeftShiftHelper()
849 JSHandle<BigInt> bigint = BigIntHelper::SetBigInt(thread, shiftBinay, BINARY); in LeftShiftHelper()
854 JSTaggedValue BigInt::UnsignedRightShift(JSThread *thread) in UnsignedRightShift()
860 JSHandle<BigInt> BigInt::copy(JSThread *thread, JSHandle<BigInt> x) in copy()
863 JSHandle<BigInt> temp = CreateBigint(thread, len); in copy()
871 JSHandle<BigInt> BigInt::UnaryMinus(JSThread *thread, JSHandle<BigInt> x) in UnaryMinus()
876 JSHandle<BigInt> y = copy(thread, x); in UnaryMinus()
881 JSHandle<BigInt> BigInt::BitwiseNOT(JSThread *thread, JSHandle<BigInt> x) in BitwiseNOT()
886 JSHandle<BigInt> result = BigintAddOne(thread, x); in BitwiseNOT()
895 JSHandle<BigInt> BigInt::Exponentiate(JSThread *thread, JSHandle<BigInt> base, JSHandle<BigInt> exp… in Exponentiate()
898 JSHandle<BigInt> bigint(thread, JSTaggedValue::Exception()); in Exponentiate()
951 JSHandle<BigInt> BigInt::Multiply(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Multiply()
985 Comparestr BigInt::ComString(std::string &a, std::string &b) in ComString()
1028 if (BigInt::ComString(a, b) == Comparestr::EQUAL) { in Minus()
1031 if (BigInt::ComString(a, b) == Comparestr::GREATER) { in Minus()
1035 if (BigInt::ComString(a, b) == Comparestr::LESS) { in Minus()
1049 result1.at(i) += BigInt::DECIMAL; in Minus()
1082 if (BigInt::ComString(a, b) == Comparestr::EQUAL) { in Divide()
1085 if (BigInt::ComString(a, b) == Comparestr::LESS) { in Divide()
1096 while (BigInt::ComString(dsy, b) == Comparestr::EQUAL || in Divide()
1097 BigInt::ComString(dsy, b) == Comparestr::GREATER) { in Divide()
1117 JSHandle<BigInt> BigIntHelper::DivideImpl(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in DivideImpl()
1119 std::string a = Conversion(GetBinary(x), BigInt::DECIMAL, BigInt::BINARY); in DivideImpl()
1120 std::string b = Conversion(GetBinary(y), BigInt::DECIMAL, BigInt::BINARY); in DivideImpl()
1127 return SetBigInt(thread, ab, BigInt::DECIMAL); in DivideImpl()
1130 JSHandle<BigInt> BigInt::Divide(JSThread *thread, JSHandle<BigInt> x, JSHandle<BigInt> y) in Divide()
1133 JSHandle<BigInt> bigint(thread, JSTaggedValue::Exception()); in Divide()
1140 JSHandle<BigInt> BigInt::Remainder(JSThread *thread, JSHandle<BigInt> n, JSHandle<BigInt> d) in Remainder()
1143 JSHandle<BigInt> bigint(thread, JSTaggedValue::Exception()); in Remainder()
1149 JSHandle<BigInt> q = Divide(thread, n, d); in Remainder()
1150 JSHandle<BigInt> p = Multiply(thread, q, d); in Remainder()
1154 JSHandle<BigInt> BigInt::FloorMod(JSThread *thread, JSHandle<BigInt> leftVal, JSHandle<BigInt> righ… in FloorMod()
1157 JSHandle<BigInt> quotientVal = Divide(thread, leftVal, rightVal); in FloorMod()
1161 JSHandle<BigInt> num = Multiply(thread, quotientVal, rightVal); in FloorMod()
1172 JSTaggedValue BigInt::AsUintN(JSThread *thread, JSTaggedNumber &bits, JSHandle<BigInt> bigint) in AsUintN()
1181 JSHandle<BigInt> exponent = Int32ToBigInt(thread, bit); in AsUintN()
1182 JSHandle<BigInt> base = Int32ToBigInt(thread, 2); // 2 : base value in AsUintN()
1183 JSHandle<BigInt> tValue = Exponentiate(thread, base, exponent); in AsUintN()
1187 JSTaggedValue BigInt::AsintN(JSThread *thread, JSTaggedNumber &bits, JSHandle<BigInt> bigint) in AsintN()
1196 JSHandle<BigInt> exp = Int32ToBigInt(thread, bit); in AsintN()
1197 JSHandle<BigInt> exponent = Int32ToBigInt(thread, bit - 1); in AsintN()
1198 JSHandle<BigInt> base = Int32ToBigInt(thread, 2); // 2 : base value in AsintN()
1199 JSHandle<BigInt> tValue = Exponentiate(thread, base, exp); in AsintN()
1200 JSHandle<BigInt> modValue = FloorMod(thread, bigint, tValue); in AsintN()
1201 JSHandle<BigInt> resValue = Exponentiate(thread, base, exponent); in AsintN()
1210 JSTaggedNumber BigInt::BigIntToNumber(JSThread *thread, JSHandle<BigInt> bigint) in BigIntToNumber()
1229 int CompareToBitsLen(JSHandle<BigInt> bigint, int numBitLen, int &preZero) in CompareToBitsLen()
1233 uint32_t bits = BigInt::DATEBITS; in CompareToBitsLen()
1242 int bigintBitLen = bigintLen * BigInt::DATEBITS - preZero; in CompareToBitsLen()
1254 ComparisonResult BigInt::CompareWithNumber(JSThread *thread, JSHandle<BigInt> bigint, JSHandle<JSTa… in CompareWithNumber()
1310 leftover = mantissaSize - BigInt::DATEBITS + preZero + 1; in CompareWithNumber()
1320 leftover -= BigInt::DATEBITS; in CompareWithNumber()
1321 doubleNum = static_cast<uint32_t>(mantissa >> BigInt::DATEBITS); in CompareWithNumber()
1322 mantissa = mantissa << BigInt::DATEBITS; in CompareWithNumber()
1329 leftover -= BigInt::DATEBITS; in CompareWithNumber()