mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-21 18:51:43 +00:00
Move some numeric builtins to stdlib; Minor refactoring
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
(module
|
||||
(type $FFFi (func (param f64 f64 f64) (result i32)))
|
||||
(type $FFF (func (param f64 f64) (result f64)))
|
||||
(type $Fi (func (param f64) (result i32)))
|
||||
(type $FFi (func (param f64 f64) (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $fffi (func (param f32 f32 f32) (result i32)))
|
||||
(type $fff (func (param f32 f32) (result f32)))
|
||||
(type $fi (func (param f32) (result i32)))
|
||||
(type $ffi (func (param f32 f32) (result i32)))
|
||||
(type $v (func))
|
||||
(import "JSOp" "mod" (func $std/mod/JSOp.mod (param f64 f64) (result f64)))
|
||||
@ -13,7 +15,18 @@
|
||||
(data (i32.const 4) "\n\00\00\00s\00t\00d\00/\00m\00o\00d\00.\00t\00s")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/math/NativeMath.mod (; 2 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
|
||||
(func $isNaN<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.const 9223372036854775807)
|
||||
)
|
||||
(i64.const 9218868437227405312)
|
||||
)
|
||||
)
|
||||
(func $~lib/math/NativeMath.mod (; 3 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64)
|
||||
(local $2 i64)
|
||||
(local $3 i32)
|
||||
(local $4 i64)
|
||||
@ -67,14 +80,8 @@
|
||||
)
|
||||
)
|
||||
(get_local $7)
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $1)
|
||||
)
|
||||
(i64.const 9223372036854775807)
|
||||
)
|
||||
(i64.const 9218868437227405312)
|
||||
(call $isNaN<f64>
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -387,26 +394,14 @@
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $std/mod/check<f64> (; 3 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32)
|
||||
(func $std/mod/check<f64> (; 4 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32)
|
||||
(if
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $1)
|
||||
)
|
||||
(i64.const 9223372036854775807)
|
||||
)
|
||||
(i64.const 9218868437227405312)
|
||||
(call $isNaN<f64>
|
||||
(get_local $1)
|
||||
)
|
||||
(return
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.const 9223372036854775807)
|
||||
)
|
||||
(i64.const 9218868437227405312)
|
||||
(call $isNaN<f64>
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -433,7 +428,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $std/mod/test_fmod (; 4 ;) (type $FFFi) (param $0 f64) (param $1 f64) (param $2 f64) (result i32)
|
||||
(func $std/mod/test_fmod (; 5 ;) (type $FFFi) (param $0 f64) (param $1 f64) (param $2 f64) (result i32)
|
||||
(local $3 i32)
|
||||
(i32.and
|
||||
(if (result i32)
|
||||
@ -464,7 +459,20 @@
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(func $~lib/math/NativeMathf.mod (; 5 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32)
|
||||
(func $isNaN<f32> (; 6 ;) (type $fi) (param $0 f32) (result i32)
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(f64.promote/f32
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i64.const 9223372036854775807)
|
||||
)
|
||||
(i64.const 9218868437227405312)
|
||||
)
|
||||
)
|
||||
(func $~lib/math/NativeMathf.mod (; 7 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
@ -513,14 +521,8 @@
|
||||
)
|
||||
)
|
||||
(get_local $3)
|
||||
(i32.gt_u
|
||||
(i32.and
|
||||
(i32.reinterpret/f32
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2147483647)
|
||||
)
|
||||
(i32.const 2139095040)
|
||||
(call $isNaN<f32>
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(i32.const 1)
|
||||
@ -818,26 +820,14 @@
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $std/mod/check<f32> (; 6 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32)
|
||||
(func $std/mod/check<f32> (; 8 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32)
|
||||
(if
|
||||
(i32.gt_u
|
||||
(i32.and
|
||||
(i32.reinterpret/f32
|
||||
(get_local $1)
|
||||
)
|
||||
(i32.const 2147483647)
|
||||
)
|
||||
(i32.const 2139095040)
|
||||
(call $isNaN<f32>
|
||||
(get_local $1)
|
||||
)
|
||||
(return
|
||||
(i32.gt_u
|
||||
(i32.and
|
||||
(i32.reinterpret/f32
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 2147483647)
|
||||
)
|
||||
(i32.const 2139095040)
|
||||
(call $isNaN<f32>
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -864,7 +854,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(func $std/mod/test_fmodf (; 7 ;) (type $fffi) (param $0 f32) (param $1 f32) (param $2 f32) (result i32)
|
||||
(func $std/mod/test_fmodf (; 9 ;) (type $fffi) (param $0 f32) (param $1 f32) (param $2 f32) (result i32)
|
||||
(call $std/mod/check<f32>
|
||||
(call $~lib/math/NativeMathf.mod
|
||||
(get_local $0)
|
||||
@ -873,7 +863,7 @@
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $start (; 8 ;) (type $v)
|
||||
(func $start (; 10 ;) (type $v)
|
||||
(if
|
||||
(i32.eqz
|
||||
(call $std/mod/test_fmod
|
||||
|
Reference in New Issue
Block a user