Home
last modified time | relevance | path

Searched refs:radix (Results 1 - 25 of 26) sorted by relevance

12

/arkcompiler/runtime_core/static_core/plugins/ets/runtime/intrinsics/helpers/
H A Dets_intrinsics_helpers.h107 inline double PowHelper(uint64_t number, int16_t exponent, uint8_t radix) in PowHelper() argument
109 const double log2Radix {std::log2(radix)}; in PowHelper()
188 inline double Strtod(const char *str, int exponent, uint8_t radix) in Strtod() argument
191 ASSERT(radix >= MIN_RADIX && radix <= MAX_RADIX); in Strtod()
195 uint64_t numberMax = (UINT64_MAX - (radix - 1)) / radix; in Strtod()
206 if (digit >= radix) { in Strtod()
210 number = number * radix + digit; in Strtod()
217 result = number / std::pow(radix, in Strtod()
227 Carry(char current, int radix) Carry() argument
245 DecimalsToString(FpType *numberInteger, FpType fraction, int radix, FpType delta) DecimalsToString() argument
276 IntegerToString(FpType number, int radix) IntegerToString() argument
375 FpToString(FpType number, int radix) FpToString() argument
[all...]
H A Dets_intrinsics_helpers.cpp40 ParseResult<int32_t> ParseExponent(const uint8_t *start, const uint8_t *end, const uint8_t radix, const uint32_t flags) in ParseExponent() argument
44 if (radix == 0) { in ParseExponent()
65 while ((digit = ToDigit(*p)) < radix) { in ParseExponent()
66 if (additionalExponent > MAX_EXPONENT / radix) { in ParseExponent()
69 additionalExponent = additionalExponent * static_cast<int32_t>(radix) + static_cast<int32_t>(digit); in ParseExponent()
88 double StringToDouble(const uint8_t *start, const uint8_t *end, uint8_t radix, uint32_t flags) in StringToDouble() argument
98 radix = 0; in StringToDouble()
130 // 4. get number radix in StringToDouble()
133 if (*p == '0' && radix == 0) { in StringToDouble()
144 radix in StringToDouble()
266 StringToDoubleWithRadix(const uint8_t *start, const uint8_t *end, int radix) StringToDoubleWithRadix() argument
[all...]
/arkcompiler/ets_runtime/ecmascript/base/tests/
H A Dnumber_helper_test.cpp53 * hexadecimal number according to the transmitted radix, and convert the hexadecimal number into a
61 int radix; in HWTEST_F_L0() local
62 radix = 2; in HWTEST_F_L0()
64 JSHandle<EcmaString> handleEcmaStr1(thread, NumberHelper::DoubleToString(thread, 37, radix)); in HWTEST_F_L0()
67 radix = 3; in HWTEST_F_L0()
69 JSHandle<EcmaString> handleEcmaStr2(thread, NumberHelper::DoubleToString(thread, -37, radix)); in HWTEST_F_L0()
72 radix = 4; in HWTEST_F_L0()
74 JSHandle<EcmaString> handleEcmaStr3(thread, NumberHelper::DoubleToString(thread, 37, radix)); in HWTEST_F_L0()
77 radix = 5; in HWTEST_F_L0()
79 JSHandle<EcmaString> handleEcmaStr4(thread, NumberHelper::DoubleToString(thread, 37, radix)); in HWTEST_F_L0()
107 int radix = 2; HWTEST_F_L0() local
478 int radix; HWTEST_F_L0() local
528 int radix; HWTEST_F_L0() local
573 int radix; HWTEST_F_L0() local
647 int radix = 2; HWTEST_F_L0() local
[all...]
/arkcompiler/ets_runtime/ecmascript/base/
H A Dnumber_helper.cpp133 JSTaggedValue NumberHelper::Int32ToString(JSThread *thread, int32_t number, uint32_t radix)
139 if (n < radix) {
153 temp = temp / radix;
162 digit = n % radix;
163 n /= radix;
174 JSTaggedValue NumberHelper::DoubleToString(JSThread *thread, double number, int radix)
197 fraction *= radix;
198 delta *= radix;
205 buffer[fractionEnd] = Carry(buffer[fractionEnd], radix);
208 buffer[fractionEnd - 1] = Carry(buffer[fractionEnd - 1], radix);
[all...]
H A Dbit_helper.h69 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in CountLeadingZeros()
107 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in CountTrailingZeros()
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/intrinsics/
H A Dstd_core_Double.cpp52 EtsString *StdCoreDoubleToString(double number, int radix) in StdCoreDoubleToString() argument
54 if (UNLIKELY(radix != helpers::DECIMAL)) { in StdCoreDoubleToString()
55 return helpers::FpToString(number, radix); in StdCoreDoubleToString()
101 double StdCoreDoubleParseInt(EtsString *s, int32_t radix) in StdCoreDoubleParseInt() argument
124 if (radix == -1 || radix == 0) { in StdCoreDoubleParseInt()
125 radix = baseDec; in StdCoreDoubleParseInt()
130 radix = baseHex; in StdCoreDoubleParseInt()
141 return std::trunc(helpers::StringToDoubleWithRadix(str.begin(), str.end(), radix)); in StdCoreDoubleParseInt()
144 return std::trunc(helpers::StringToDoubleWithRadix(str.begin(), str.end(), radix)); in StdCoreDoubleParseInt()
[all...]
H A Dstd_core_Float.cpp23 EtsString *StdCoreFloatToString(float number, int radix) in StdCoreFloatToString() argument
25 if (UNLIKELY(radix != helpers::DECIMAL)) { in StdCoreFloatToString()
26 return helpers::FpToString(number, radix); in StdCoreFloatToString()
/arkcompiler/ets_runtime/ecmascript/builtins/tests/
H A Dbuiltins_number_test.cpp542 // testcases of StringToDouble radix
548 int radix; in HWTEST_F_L0() local
550 radix = 0; // default 10 in HWTEST_F_L0()
553 ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 100); in HWTEST_F_L0()
556 ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 10030); in HWTEST_F_L0()
557 radix = 1; in HWTEST_F_L0()
560 ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 0); in HWTEST_F_L0()
563 ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS))); in HWTEST_F_L0()
564 radix = 2; in HWTEST_F_L0()
567 ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, bas in HWTEST_F_L0()
[all...]
H A Dbuiltins_bigint_test.cpp260 JSHandle<JSTaggedValue> radix(thread, JSTaggedValue(2)); in HWTEST_F_L0()
261 std::vector<JSTaggedValue> vals2{radix.GetTaggedValue()}; in HWTEST_F_L0()
279 JSHandle<JSTaggedValue> radix(thread, JSTaggedValue(16)); in HWTEST_F_L0()
280 std::vector<JSTaggedValue> vals2{radix.GetTaggedValue()}; in HWTEST_F_L0()
/arkcompiler/ets_runtime/test/moduletest/regressparseInt/
H A DregressparseInt.js23 let radix = { valueOf: function() { result = "InvalidRadix"; throw null; } };
24 try { parseInt(str, radix); } catch (e) {}
/arkcompiler/ets_runtime/ecmascript/builtins/
H A Dbuiltins_bigint.cpp173 // 2. If radix is not present, let radixNumber be 10 in ToString()
174 double radix = base::DECIMAL; in ToString() local
176 // 3. Else, let radixNumber be ? ToIntegerOrInfinity(radix). in ToString()
180 radix = radixNumber.GetNumber(); in ToString()
183 if (radix < base::MIN_RADIX || radix > base::MAX_RADIX) { in ToString()
184 THROW_RANGE_ERROR_AND_RETURN(thread, "toString() radix argument must be between 2 and 36", in ToString()
188 if (radix == base::DECIMAL) { in ToString()
191 // 6. Return the String representation of this BigInt value using the radix specified by radixNumber in ToString()
192 return BigInt::ToString(thread, thisBigint, static_cast<int>(radix)) in ToString()
[all...]
H A Dbuiltins_number.cpp187 int32_t radix = 0; in ParseInt() local
193 // 7. Let R = ToInt32(radix). in ParseInt()
194 radix = JSTaggedValue::ToInt32(thread, arg2); in ParseInt()
198 return NumberHelper::StringToNumber(*numberString, radix); in ParseInt()
418 // 3. If radix is not present, let radixNumber be 10. in ToString()
419 // 4. Else if radix is undefined, let radixNumber be 10. in ToString()
420 double radix = base::DECIMAL; in ToString() local
422 // 5. Else let radixNumber be ToInteger(radix). in ToString()
424 radix = radixValue->GetInt(); in ToString()
429 radix in ToString()
[all...]
/arkcompiler/ets_runtime/ecmascript/compiler/builtins/
H A Dbuiltins_number_stub_builder.cpp60 DEFVARIABLE(radix, VariableType::INT32(), Int32(0)); in ParseInt()
75 radix = GetInt32OfTInt(arg2); in ParseInt()
81 *result = CallNGCRuntime(glue_, RTSTUB_ID(StringToNumber), { msg, *radix }); in ParseInt()
329 *result = NumberToString(thisValueInt, Int32(10)); // 10: means radix in ToString()
356 GateRef BuiltinsNumberStubBuilder::NumberToString(GateRef number, GateRef radix) in NumberToString() argument
390 BRANCH(Int32LessThan(number, radix), &thisIsSingle, &afterFast); in NumberToString()
422 temp = Int32Div(*temp, radix); in NumberToString()
451 digit = Int32Mod(*n, radix); in NumberToString()
452 n = Int32Div(*n, radix); in NumberToString()
H A Dbuiltins_number_stub_builder.h37 GateRef NumberToString(GateRef number, GateRef radix);
/arkcompiler/runtime_core/libpandabase/utils/
H A Dbit_utils.h51 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Clz()
67 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Ctz()
83 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Popcount()
108 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in MinimumBitsToStore()
122 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Ffs()
[all...]
/arkcompiler/runtime_core/static_core/libpandabase/utils/
H A Dbit_utils.h52 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Clz()
68 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Ctz()
84 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Popcount()
109 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in MinimumBitsToStore()
123 static_assert(std::numeric_limits<T>::radix == RADIX, "Unexpected radix!"); in Ffs()
[all...]
/arkcompiler/ets_frontend/es2panda/lexer/
H A Dlexer.h160 template <bool rangeCheck(char32_t), int radix>
334 template <bool rangeCheck(char32_t), int radix>
349 number = number * radix + HexValue(cp); in ScanNumberRadix()
/arkcompiler/runtime_core/static_core/plugins/ets/compiler/optimizer/
H A Dets_intrinsics_peephole.cpp331 auto radix = intrinsic->GetInput(1U).GetInst(); in PeepholeDoubleToString() local
333 if (!(radix->IsConst() && radix->CastToConstant()->GetIntValue() == TEN)) { in PeepholeDoubleToString()
/arkcompiler/ets_runtime/ecmascript/debugger/
H A Ddebugger_api.h137 static double StringToDouble(const uint8_t *start, const uint8_t *end, uint8_t radix);
H A Ddebugger_api.cpp237 double DebuggerApi::StringToDouble(const uint8_t *start, const uint8_t *end, uint8_t radix) in StringToDouble() argument
239 return NumberHelper::StringToDouble(start, end, radix, ALLOW_BINARY | ALLOW_HEX | ALLOW_OCTAL); in StringToDouble()
/arkcompiler/ets_runtime/ecmascript/compiler/
H A Dnative_inline_lowering.cpp674 auto radix = builder_.Undefined(); in TryInlineNumberParseInt() local
676 radix = acc_.GetValueIn(gate, firstParam + 1); in TryInlineNumberParseInt()
687 GateRef ret = builder_.NumberParseInt(arg, radix); in TryInlineNumberParseInt()
H A Dmcr_circuit_builder.cpp1720 GateRef CircuitBuilder::StringToNumber(GateRef gate, GateRef value, GateRef radix, GateRef glue) in StringToNumber() argument
1722 return CallNGCRuntime(glue, RTSTUB_ID(StringToNumber), Gate::InvalidGateRef, { value, radix }, gate); in StringToNumber()
2059 GateRef CircuitBuilder::NumberParseInt(GateRef gate, GateRef radix) in NumberParseInt() argument
2066 { currentControl, currentDepend, gate, radix }, GateType::AnyType()); in NumberParseInt()
H A Dcircuit_builder.h776 GateRef NumberParseInt(GateRef gate, GateRef radix);
804 GateRef StringToNumber(GateRef gate, GateRef value, GateRef radix, GateRef glue);
/arkcompiler/ets_runtime/ecmascript/stubs/
H A Druntime_stubs.h147 static JSTaggedValue StringToNumber(JSTaggedType numberString, int32_t radix);
H A Druntime_stubs.cpp698 out << std::dec << std::setfill(' '); // Recovers integer radix & fill character in DumpToStreamWithHint()
3851 int32_t radix = 0; in DEF_RUNTIME_STUBS() local
3856 // 7. Let R = ToInt32(radix). in DEF_RUNTIME_STUBS()
3857 radix = JSTaggedValue::ToInt32(thread, arg2); in DEF_RUNTIME_STUBS()
3861 return base::NumberHelper::StringToNumber(*numberString, radix).GetRawData(); in DEF_RUNTIME_STUBS()
3895 JSTaggedValue RuntimeStubs::StringToNumber(JSTaggedType numberString, int32_t radix) in StringToNumber() argument
3899 return base::NumberHelper::StringToNumber(input, radix); in StringToNumber()

Completed in 35 milliseconds

12