MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / _LtoStr

Function _LtoStr

vm/ByteCodeTranslator/src/javascript/parparvm_runtime.js:3836–3859  ·  view source on GitHub ↗
(a, radix)

Source from the content-addressed store, hash-verified

3834}
3835function _Ll2i(x) { return _Lc(x).l | 0; } // low 32 bits as signed int (Number)
3836function _LtoStr(a, radix) {
3837 a = _Lc(a); radix = (radix | 0) || 10;
3838 if (_LisZero(a)) return "0";
3839 if (_LisNeg(a)) {
3840 if (_Leq(a, _LMIN)) {
3841 const r = _LfromInt(radix);
3842 const div = _Ldiv(a, r);
3843 const rem = _Lsub(_Lmul(div, r), a);
3844 return _LtoStr(div, radix) + (_Ll2i(rem) >>> 0).toString(radix);
3845 }
3846 return "-" + _LtoStr(_Lneg(a), radix);
3847 }
3848 let rem = a, result = "";
3849 const radixToPower = _LfromNumber(Math.pow(radix, 6));
3850 for (;;) {
3851 const remDiv = _Ldiv(rem, radixToPower);
3852 const intval = (_Ll2i(_Lsub(rem, _Lmul(remDiv, radixToPower)))) >>> 0;
3853 let digits = intval.toString(radix);
3854 rem = remDiv;
3855 if (_LisZero(rem)) return digits + result;
3856 while (digits.length < 6) digits = "0" + digits;
3857 result = digits + result;
3858 }
3859}
3860global._Lc = _Lc;
3861global._LtoNum = _LtoNum;
3862global._LtoStr = _LtoStr;

Callers 3

toNativeStringFunction · 0.85
runtimeFormatTokenValueFunction · 0.85

Calls 13

_LcFunction · 0.85
_LisZeroFunction · 0.85
_LisNegFunction · 0.85
_LeqFunction · 0.85
_LfromIntFunction · 0.85
_LdivFunction · 0.85
_LsubFunction · 0.85
_LmulFunction · 0.85
_Ll2iFunction · 0.85
_LnegFunction · 0.85
_LfromNumberFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected