mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 06:51:34 +00:00
Minor itoa improvements (#168)
This commit is contained in:
@ -3744,27 +3744,14 @@
|
||||
(i32.const 552)
|
||||
)
|
||||
(i32.shl
|
||||
(tee_local $0
|
||||
(tee_local $1
|
||||
(i32.shr_u
|
||||
(i32.mul
|
||||
(i32.sub
|
||||
(i32.const 32)
|
||||
(i32.clz
|
||||
(i32.or
|
||||
(tee_local $1
|
||||
(i32.sub
|
||||
(i32.xor
|
||||
(get_local $0)
|
||||
(tee_local $0
|
||||
(i32.shr_u
|
||||
(get_local $0)
|
||||
(i32.const 31)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
@ -3781,9 +3768,9 @@
|
||||
)
|
||||
(i32.add
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
(i32.lt_u
|
||||
(get_local $1)
|
||||
(get_local $0)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
@ -4032,7 +4019,7 @@
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(set_local $2
|
||||
(i32.le_s
|
||||
(i32.le_u
|
||||
(tee_local $1
|
||||
(i32.shr_u
|
||||
(i32.mul
|
||||
@ -4041,20 +4028,7 @@
|
||||
(i32.wrap/i64
|
||||
(i64.clz
|
||||
(i64.or
|
||||
(tee_local $0
|
||||
(i64.sub
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(tee_local $0
|
||||
(i64.shr_u
|
||||
(get_local $0)
|
||||
(i64.const 63)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
(i64.const 10)
|
||||
)
|
||||
)
|
||||
@ -4108,7 +4082,7 @@
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(set_local $4
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(i32.const 1472)
|
||||
)
|
||||
@ -4124,7 +4098,7 @@
|
||||
(i32.div_u
|
||||
(tee_local $5
|
||||
(i32.div_u
|
||||
(tee_local $3
|
||||
(tee_local $4
|
||||
(i32.wrap/i64
|
||||
(i64.sub
|
||||
(get_local $1)
|
||||
@ -4168,12 +4142,12 @@
|
||||
(i64.or
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(i32.div_u
|
||||
(tee_local $3
|
||||
(tee_local $4
|
||||
(i32.rem_u
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
(i32.const 10000)
|
||||
)
|
||||
)
|
||||
@ -4186,10 +4160,10 @@
|
||||
(i64.shl
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(i32.rem_u
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
(i32.const 100)
|
||||
)
|
||||
(i32.const 2)
|
||||
@ -4216,7 +4190,7 @@
|
||||
(i64.or
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $6)
|
||||
(i32.const 2)
|
||||
@ -4226,7 +4200,7 @@
|
||||
(i64.shl
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(i32.const 2)
|
||||
@ -4241,17 +4215,12 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(tee_local $3
|
||||
(i32.wrap/i64
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(call $~lib/internal/itoa/utoa32_lut
|
||||
(get_local $0)
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(call $~lib/internal/itoa/utoa32_lut
|
||||
(get_local $0)
|
||||
(i32.wrap/i64
|
||||
(get_local $1)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32)
|
||||
|
@ -4454,29 +4454,10 @@
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(set_local $1
|
||||
(i32.shr_u
|
||||
(get_local $0)
|
||||
(i32.sub
|
||||
(i32.mul
|
||||
(i32.const 8)
|
||||
(i32.const 4)
|
||||
)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(i32.xor
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.sub
|
||||
(i32.mul
|
||||
(i32.const 8)
|
||||
@ -4484,52 +4465,52 @@
|
||||
)
|
||||
(i32.clz
|
||||
(i32.or
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(set_local $3
|
||||
(i32.shr_u
|
||||
(i32.mul
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1233)
|
||||
)
|
||||
(i32.const 12)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
(set_local $4
|
||||
(i32.load
|
||||
(block $~lib/internal/itoa/getPowers10Table|inlined.0 (result i32)
|
||||
(block $~lib/internal/itoa/POWERS10|inlined.0 (result i32)
|
||||
(i32.const 552)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
(set_local $5
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u32>|inlined.0 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(set_local $3
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.lt_u
|
||||
(get_local $2)
|
||||
(get_local $6)
|
||||
(get_local $1)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
@ -4541,10 +4522,9 @@
|
||||
(local $7 i32)
|
||||
(local $8 i64)
|
||||
(local $9 i64)
|
||||
(local $10 i32)
|
||||
(set_local $7
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(block $~lib/internal/itoa/getDigitsTable|inlined.0 (result i32)
|
||||
(block $~lib/internal/itoa/DIGITS|inlined.0 (result i32)
|
||||
(i32.const 624)
|
||||
)
|
||||
)
|
||||
@ -4564,7 +4544,7 @@
|
||||
(i32.const 10000)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(set_local $5
|
||||
(i32.rem_u
|
||||
(get_local $1)
|
||||
(i32.const 10000)
|
||||
@ -4573,15 +4553,15 @@
|
||||
(set_local $1
|
||||
(get_local $4)
|
||||
)
|
||||
(set_local $5
|
||||
(set_local $6
|
||||
(i32.div_u
|
||||
(get_local $3)
|
||||
(get_local $5)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
(set_local $7
|
||||
(i32.rem_u
|
||||
(get_local $3)
|
||||
(get_local $5)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
@ -4589,9 +4569,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.0 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $7)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(get_local $6)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -4602,9 +4582,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.1 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $7)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $6)
|
||||
(get_local $7)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -4645,20 +4625,20 @@
|
||||
(i32.const 100)
|
||||
)
|
||||
(block
|
||||
(set_local $4
|
||||
(set_local $7
|
||||
(i32.div_u
|
||||
(get_local $1)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
(set_local $6
|
||||
(i32.rem_u
|
||||
(get_local $1)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(get_local $4)
|
||||
(get_local $7)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
@ -4666,13 +4646,13 @@
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(set_local $5
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u32>|inlined.1 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $7)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $5)
|
||||
(get_local $6)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -4687,7 +4667,7 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $10)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -4703,11 +4683,11 @@
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(set_local $5
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u32>|inlined.2 (result i32)
|
||||
(i32.load offset=8
|
||||
(i32.add
|
||||
(get_local $7)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
@ -4724,7 +4704,7 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $10)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(block
|
||||
@ -4734,7 +4714,7 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(set_local $5
|
||||
(i32.add
|
||||
(i32.const 48)
|
||||
(get_local $1)
|
||||
@ -4748,7 +4728,7 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $10)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -4841,37 +4821,18 @@
|
||||
)
|
||||
(func $~lib/internal/itoa/decimalCount<u64> (; 31 ;) (type $Ii) (param $0 i64) (result i32)
|
||||
(local $1 i64)
|
||||
(local $2 i64)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
(local $8 i64)
|
||||
(local $9 i32)
|
||||
(local $10 i64)
|
||||
(local $7 i64)
|
||||
(local $8 i32)
|
||||
(local $9 i64)
|
||||
(set_local $1
|
||||
(i64.shr_u
|
||||
(get_local $0)
|
||||
(i64.sub
|
||||
(i64.mul
|
||||
(i64.const 8)
|
||||
(i64.const 8)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.sub
|
||||
(i64.xor
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
)
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.sub
|
||||
(i32.mul
|
||||
(i32.const 8)
|
||||
@ -4880,88 +4841,88 @@
|
||||
(i32.wrap/i64
|
||||
(i64.clz
|
||||
(i64.or
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i64.const 10)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(set_local $3
|
||||
(i32.shr_u
|
||||
(i32.mul
|
||||
(get_local $3)
|
||||
(get_local $2)
|
||||
(i32.const 1233)
|
||||
)
|
||||
(i32.const 12)
|
||||
)
|
||||
)
|
||||
(set_local $5
|
||||
(set_local $4
|
||||
(i32.load
|
||||
(block $~lib/internal/itoa/getPowers10Table|inlined.1 (result i32)
|
||||
(block $~lib/internal/itoa/POWERS10|inlined.1 (result i32)
|
||||
(i32.const 1400)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
(i32.le_s
|
||||
(get_local $4)
|
||||
(set_local $5
|
||||
(i32.le_u
|
||||
(get_local $3)
|
||||
(i32.const 10)
|
||||
)
|
||||
)
|
||||
(set_local $6
|
||||
(select
|
||||
(i32.const 0)
|
||||
(i32.const 10)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(select
|
||||
(i32.const 0)
|
||||
(i32.const 10)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
(select
|
||||
(i64.const 1)
|
||||
(i64.const 10000000000)
|
||||
(get_local $6)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(set_local $9
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.2 (result i64)
|
||||
(set_local $9
|
||||
(set_local $8
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(get_local $7)
|
||||
(get_local $3)
|
||||
(get_local $6)
|
||||
)
|
||||
)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $5)
|
||||
(get_local $4)
|
||||
(i32.shl
|
||||
(get_local $9)
|
||||
(get_local $8)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(set_local $3
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i64.lt_u
|
||||
(get_local $2)
|
||||
(get_local $1)
|
||||
(i64.mul
|
||||
(get_local $8)
|
||||
(get_local $10)
|
||||
(get_local $7)
|
||||
(get_local $9)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $4)
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/itoa/utoa64_lut (; 32 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32)
|
||||
(local $3 i64)
|
||||
(local $4 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i64)
|
||||
(local $5 i32)
|
||||
(local $6 i32)
|
||||
(local $7 i32)
|
||||
@ -4971,9 +4932,9 @@
|
||||
(local $11 i32)
|
||||
(local $12 i64)
|
||||
(local $13 i64)
|
||||
(set_local $11
|
||||
(set_local $3
|
||||
(i32.load
|
||||
(block $~lib/internal/itoa/getDigitsTable|inlined.1 (result i32)
|
||||
(block $~lib/internal/itoa/DIGITS|inlined.1 (result i32)
|
||||
(i32.const 1472)
|
||||
)
|
||||
)
|
||||
@ -4987,59 +4948,59 @@
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(set_local $3
|
||||
(set_local $4
|
||||
(i64.div_u
|
||||
(get_local $1)
|
||||
(i64.const 100000000)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(set_local $5
|
||||
(i32.wrap/i64
|
||||
(i64.sub
|
||||
(get_local $1)
|
||||
(i64.mul
|
||||
(get_local $3)
|
||||
(get_local $4)
|
||||
(i64.const 100000000)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(get_local $3)
|
||||
)
|
||||
(set_local $5
|
||||
(i32.div_u
|
||||
(get_local $4)
|
||||
(i32.const 10000)
|
||||
)
|
||||
(get_local $4)
|
||||
)
|
||||
(set_local $6
|
||||
(i32.rem_u
|
||||
(get_local $4)
|
||||
(i32.div_u
|
||||
(get_local $5)
|
||||
(i32.const 10000)
|
||||
)
|
||||
)
|
||||
(set_local $7
|
||||
(i32.div_u
|
||||
(i32.rem_u
|
||||
(get_local $5)
|
||||
(i32.const 100)
|
||||
(i32.const 10000)
|
||||
)
|
||||
)
|
||||
(set_local $8
|
||||
(i32.rem_u
|
||||
(get_local $5)
|
||||
(i32.div_u
|
||||
(get_local $6)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $9
|
||||
(i32.div_u
|
||||
(i32.rem_u
|
||||
(get_local $6)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(i32.div_u
|
||||
(get_local $7)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
(set_local $11
|
||||
(i32.rem_u
|
||||
(get_local $6)
|
||||
(get_local $7)
|
||||
(i32.const 100)
|
||||
)
|
||||
)
|
||||
@ -5047,9 +5008,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.3 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $11)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $9)
|
||||
(get_local $10)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -5060,9 +5021,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.4 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $11)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $10)
|
||||
(get_local $11)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -5095,9 +5056,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.5 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $11)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $7)
|
||||
(get_local $8)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -5108,9 +5069,9 @@
|
||||
(block $~lib/internal/arraybuffer/loadUnsafe<u32,u64>|inlined.6 (result i64)
|
||||
(i64.load32_u offset=8
|
||||
(i32.add
|
||||
(get_local $11)
|
||||
(get_local $3)
|
||||
(i32.shl
|
||||
(get_local $8)
|
||||
(get_local $9)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
@ -5145,18 +5106,12 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(call $~lib/internal/itoa/utoa32_lut
|
||||
(get_local $0)
|
||||
(i32.wrap/i64
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(get_local $4)
|
||||
(call $~lib/internal/itoa/utoa32_lut
|
||||
(get_local $0)
|
||||
(get_local $4)
|
||||
(get_local $2)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32)
|
||||
|
Reference in New Issue
Block a user