if that's what's necessary

This commit is contained in:
dcode
2019-03-14 06:09:49 +01:00
parent a5e14a0eaa
commit 84ddd97761
25 changed files with 1845 additions and 769 deletions

View File

@ -2,10 +2,12 @@ import { runtime } from "../runtime";
import { CharCode } from "./string";
// @ts-ignore: decorator
@inline export const MAX_DOUBLE_LENGTH = 28;
@inline
export const MAX_DOUBLE_LENGTH = 28;
// @ts-ignore: decorator
@lazy @inline const POWERS10: u32[] = [
@lazy @inline
const POWERS10: u32[] = [
1,
10,
100,
@ -33,7 +35,8 @@ import { CharCode } from "./string";
"90", "91", "92", "93", "94", "95", "96", "97", "98", "99"
*/
// @ts-ignore: decorator
@lazy @inline const DIGITS: u32[] = [
@lazy @inline
const DIGITS: u32[] = [
0x00300030, 0x00310030, 0x00320030, 0x00330030, 0x00340030,
0x00350030, 0x00360030, 0x00370030, 0x00380030, 0x00390030,
0x00300031, 0x00310031, 0x00320031, 0x00330031, 0x00340031,
@ -57,7 +60,8 @@ import { CharCode } from "./string";
];
// @ts-ignore: decorator
@lazy @inline const EXP_POWERS: i16[] = [
@lazy @inline
const EXP_POWERS: i16[] = [
-1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980,
-954, -927, -901, -874, -847, -821, -794, -768, -741, -715,
-688, -661, -635, -608, -582, -555, -529, -502, -475, -449,
@ -71,7 +75,8 @@ import { CharCode } from "./string";
// 1e-348, 1e-340, ..., 1e340
// @ts-ignore: decorator
@lazy @inline const FRC_POWERS: u64[] = [
@lazy @inline
const FRC_POWERS: u64[] = [
0xFA8FD5A0081C0288, 0xBAAEE17FA23EBF76, 0x8B16FB203055AC76, 0xCF42894A5DCE35EA,
0x9A6BB0AA55653B2D, 0xE61ACF033D1A45DF, 0xAB70FE17C79AC6CA, 0xFF77B1FCBEBCDC4F,
0xBE5691EF416BD60C, 0x8DD01FAD907FFC3C, 0xD3515C2831559A83, 0x9D71AC8FADA6C9B5,
@ -105,7 +110,7 @@ export function decimalCount32(value: u32): u32 {
let lutbuf = <ArrayBuffer>POWERS10.buffer_;
let power = LOAD<u32>(lutbuf, t);
t -= <u32>(value < power);
t -= u32(value < power);
return t + 1;
} else {
if (value < 100000) {
@ -135,7 +140,7 @@ export function decimalCount64(value: u64): u32 {
let lutbuf = <ArrayBuffer>POWERS10.buffer_;
let power = LOAD<u32,u64>(lutbuf, t - 10);
t -= <u32>(value < 10000000000 * power);
t -= u32(value < 10000000000 * power);
return t + 1;
} else {
if (value < 1000000000000000) {