mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Add integer power functions (#212)
This commit is contained in:
parent
658ab23ea6
commit
c27b6e8951
@ -2303,3 +2303,111 @@ export namespace NativeMathf {
|
||||
return sx ? -x : x;
|
||||
}
|
||||
}
|
||||
|
||||
export function ipow32(x: i32, e: i32): i32 {
|
||||
var out = 1;
|
||||
if (ASC_SHRINK_LEVEL < 1) {
|
||||
if (e < 0) return 0;
|
||||
|
||||
switch (e) {
|
||||
case 0: return 1;
|
||||
case 1: return x;
|
||||
case 2: return x * x;
|
||||
}
|
||||
|
||||
let log = 32 - clz(e);
|
||||
if (log <= 5) {
|
||||
// 32 = 2 ^ 5, so need only five cases.
|
||||
// But some extra cases needs for properly overflowing
|
||||
switch (log) {
|
||||
case 5: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 4: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 3: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 2: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 1: {
|
||||
if (e & 1) out *= x;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
while (e > 0) {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function ipow64(x: i64, e: i32): i64 {
|
||||
var out: i64 = 1;
|
||||
if (ASC_SHRINK_LEVEL < 1) {
|
||||
if (e < 0) return 0;
|
||||
switch (e) {
|
||||
case 0: return 1;
|
||||
case 1: return x;
|
||||
case 2: return x * x;
|
||||
}
|
||||
|
||||
let log = 32 - clz(e);
|
||||
if (log <= 6) {
|
||||
// 64 = 2 ^ 6, so need only six cases.
|
||||
// But some extra cases needs for properly overflowing
|
||||
switch (log) {
|
||||
case 6: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 5: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 4: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 3: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 2: {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
case 1: {
|
||||
if (e & 1) out *= x;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
while (e > 0) {
|
||||
if (e & 1) out *= x;
|
||||
e >>= 1;
|
||||
x *= x;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
(type $Iv (func (param i64)))
|
||||
(type $II (func (param i64) (result i64)))
|
||||
(type $f (func (result f32)))
|
||||
(type $IiI (func (param i64 i32) (result i64)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "JSMath" "E" (global $~lib/math/JSMath.E f64))
|
||||
@ -13981,7 +13982,277 @@
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(func $start (; 158 ;) (; has Stack IR ;) (type $v)
|
||||
(func $~lib/math/ipow64 (; 158 ;) (; has Stack IR ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64)
|
||||
(local $2 i64)
|
||||
(local $3 i32)
|
||||
(set_local $2
|
||||
(i64.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(return
|
||||
(i64.const 0)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(block $case2|0
|
||||
(block $case1|0
|
||||
(if
|
||||
(get_local $1)
|
||||
(block
|
||||
(br_if $case1|0
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br_if $case2|0
|
||||
(i32.eq
|
||||
(get_local $1)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(br $break|0)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.le_s
|
||||
(tee_local $3
|
||||
(i32.sub
|
||||
(i32.const 32)
|
||||
(i32.clz
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.const 6)
|
||||
)
|
||||
(block
|
||||
(block $break|1
|
||||
(block $case5|1
|
||||
(block $case4|1
|
||||
(block $case3|1
|
||||
(block $case2|1
|
||||
(block $case1|1
|
||||
(if
|
||||
(i32.ne
|
||||
(get_local $3)
|
||||
(i32.const 6)
|
||||
)
|
||||
(block
|
||||
(br_if $case1|1
|
||||
(i32.eq
|
||||
(get_local $3)
|
||||
(i32.const 5)
|
||||
)
|
||||
)
|
||||
(block $tablify|0
|
||||
(br_table $case5|1 $case4|1 $case3|1 $case2|1 $tablify|0
|
||||
(i32.sub
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $break|1)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(loop $continue|2
|
||||
(if
|
||||
(i32.gt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(br $continue|2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(func $start (; 159 ;) (; has Stack IR ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 f64)
|
||||
@ -53243,5 +53514,515 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3123)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3124)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3125)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3126)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3128)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3129)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3130)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3131)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3133)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 2)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3134)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 4)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3135)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 8)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3136)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3138)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const -1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3139)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3140)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const -1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3141)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3143)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const -2)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3144)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 4)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3145)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const -8)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3146)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 40)
|
||||
)
|
||||
(i64.const -6289078614652622815)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3148)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 41)
|
||||
)
|
||||
(i64.const -420491770248316829)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3149)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 42)
|
||||
)
|
||||
(i64.const -1261475310744950487)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3150)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 43)
|
||||
)
|
||||
(i64.const -3784425932234851461)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3151)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 63)
|
||||
)
|
||||
(i64.const -3237885987332494933)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3152)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 64)
|
||||
)
|
||||
(i64.const 8733086111712066817)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3153)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 128)
|
||||
)
|
||||
(i64.const -9204772141784466943)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3154)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.ne
|
||||
(i64.add
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 57055)
|
||||
(i32.const 3)
|
||||
)
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 339590)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(i64.const 39347712995520375)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3156)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -3117,3 +3117,40 @@ assert(test_truncf(0.9999923706, 0.0, 0.0, INEXACT));
|
||||
assert(test_truncf(-0.9999923706, -0.0, 0.0, INEXACT));
|
||||
assert(test_truncf(7.888609052e-31, 0.0, 0.0, INEXACT));
|
||||
assert(test_truncf(-7.888609052e-31, -0.0, 0.0, INEXACT));
|
||||
|
||||
// ipow64 /////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
assert(ipow64(0, 0) == 1);
|
||||
assert(ipow64(0, 1) == 0);
|
||||
assert(ipow64(0, 2) == 0);
|
||||
assert(ipow64(0, 3) == 0);
|
||||
|
||||
assert(ipow64(1, 0) == 1);
|
||||
assert(ipow64(1, 1) == 1);
|
||||
assert(ipow64(1, 2) == 1);
|
||||
assert(ipow64(1, 3) == 1);
|
||||
|
||||
assert(ipow64(2, 0) == 1);
|
||||
assert(ipow64(2, 1) == 2);
|
||||
assert(ipow64(2, 2) == 4);
|
||||
assert(ipow64(2, 3) == 8);
|
||||
|
||||
assert(ipow64(-1, 0) == 1);
|
||||
assert(ipow64(-1, 1) == -1);
|
||||
assert(ipow64(-1, 2) == 1);
|
||||
assert(ipow64(-1, 3) == -1);
|
||||
|
||||
assert(ipow64(-2, 0) == 1);
|
||||
assert(ipow64(-2, 1) == -2);
|
||||
assert(ipow64(-2, 2) == 4);
|
||||
assert(ipow64(-2, 3) == -8);
|
||||
|
||||
assert(ipow64(3, 40) == 12157665459056928801);
|
||||
assert(ipow64(3, 41) == -420491770248316829); // should overflow
|
||||
assert(ipow64(3, 42) == -1261475310744950487); // should overflow
|
||||
assert(ipow64(3, 43) == -3784425932234851461); // should overflow
|
||||
assert(ipow64(3, 63) == -3237885987332494933); // should overflow
|
||||
assert(ipow64(3, 64) == 8733086111712066817); // should overflow
|
||||
assert(ipow64(3, 128) == -9204772141784466943); // should overflow
|
||||
|
||||
assert(ipow64(57055, 3) + ipow64(339590, 3) == 39347712995520375); // add Buterin's twit example
|
||||
|
@ -20,6 +20,7 @@
|
||||
(type $Iv (func (param i64)))
|
||||
(type $II (func (param i64) (result i64)))
|
||||
(type $f (func (result f32)))
|
||||
(type $IiI (func (param i64 i32) (result i64)))
|
||||
(type $v (func))
|
||||
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
|
||||
(import "JSMath" "E" (global $~lib/math/JSMath.E f64))
|
||||
@ -85,6 +86,7 @@
|
||||
(global $~lib/math/random_state1 (mut i64) (i64.const 0))
|
||||
(global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16))
|
||||
(global $~lib/builtins/f32.EPSILON f32 (f32.const 1.1920928955078125e-07))
|
||||
(global $ASC_SHRINK_LEVEL i32 (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 68))
|
||||
(memory $0 1)
|
||||
(data (i32.const 8) "\0b\00\00\00s\00t\00d\00/\00m\00a\00t\00h\00.\00t\00s\00")
|
||||
@ -16116,7 +16118,321 @@
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(func $start (; 158 ;) (type $v)
|
||||
(func $~lib/math/ipow64 (; 158 ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64)
|
||||
(local $2 i64)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(set_local $2
|
||||
(i64.const 1)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(return
|
||||
(i64.const 0)
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(block $case2|0
|
||||
(block $case1|0
|
||||
(block $case0|0
|
||||
(set_local $3
|
||||
(get_local $1)
|
||||
)
|
||||
(br_if $case0|0
|
||||
(i32.eq
|
||||
(get_local $3)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(br_if $case1|0
|
||||
(i32.eq
|
||||
(get_local $3)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br_if $case2|0
|
||||
(i32.eq
|
||||
(get_local $3)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(br $break|0)
|
||||
)
|
||||
(return
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(i32.sub
|
||||
(i32.const 32)
|
||||
(i32.clz
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.le_s
|
||||
(get_local $3)
|
||||
(i32.const 6)
|
||||
)
|
||||
(block
|
||||
(block $break|1
|
||||
(block $case5|1
|
||||
(block $case4|1
|
||||
(block $case3|1
|
||||
(block $case2|1
|
||||
(block $case1|1
|
||||
(block $case0|1
|
||||
(set_local $4
|
||||
(get_local $3)
|
||||
)
|
||||
(br_if $case0|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 6)
|
||||
)
|
||||
)
|
||||
(br_if $case1|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 5)
|
||||
)
|
||||
)
|
||||
(br_if $case2|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(br_if $case3|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(br_if $case4|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
(br_if $case5|1
|
||||
(i32.eq
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $break|1)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(return
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(block $break|2
|
||||
(loop $continue|2
|
||||
(if
|
||||
(i32.gt_s
|
||||
(get_local $1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i32.and
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.mul
|
||||
(get_local $2)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(i32.shr_s
|
||||
(get_local $1)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(i64.mul
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(br $continue|2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
(func $start (; 159 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 f64)
|
||||
(local $2 i32)
|
||||
@ -56130,5 +56446,571 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3123)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3124)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3125)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 0)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 0)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3126)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3128)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3129)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3130)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3131)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3133)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const 2)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3134)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 4)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3135)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const 8)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3136)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3138)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const -1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3139)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3140)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -1)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const -1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3141)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 0)
|
||||
)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3143)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(i64.const -2)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3144)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 2)
|
||||
)
|
||||
(i64.const 4)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3145)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const -2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(i64.const -8)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3146)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 40)
|
||||
)
|
||||
(i64.const -6289078614652622815)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3148)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 41)
|
||||
)
|
||||
(i64.const -420491770248316829)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3149)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 42)
|
||||
)
|
||||
(i64.const -1261475310744950487)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3150)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 43)
|
||||
)
|
||||
(i64.const -3784425932234851461)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3151)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 63)
|
||||
)
|
||||
(i64.const -3237885987332494933)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3152)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 64)
|
||||
)
|
||||
(i64.const 8733086111712066817)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3153)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 3)
|
||||
(i32.const 128)
|
||||
)
|
||||
(i64.const -9204772141784466943)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3154)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i64.eq
|
||||
(i64.add
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 57055)
|
||||
(i32.const 3)
|
||||
)
|
||||
(call $~lib/math/ipow64
|
||||
(i64.const 339590)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(i64.const 39347712995520375)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 3156)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user