mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-31 06:02:11 +00:00
Simplify isFinite & isNaN (#78)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $F (func (result f64)))
|
||||
(type $fi (func (param f32) (result i32)))
|
||||
(type $i (func (result i32)))
|
||||
(type $Fi (func (param f64) (result i32)))
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(type $f (func (result f32)))
|
||||
(import "env" "abort" (func $abort (param i32 i32 i32 i32)))
|
||||
@@ -27,81 +27,39 @@
|
||||
(start $start)
|
||||
(func $isNaN<f32> (; 1 ;) (type $fi) (param $0 f32) (result i32)
|
||||
(return
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(f64.promote/f32
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i64.shr_u
|
||||
(i64.const -1)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(i64.shl
|
||||
(i64.const 2047)
|
||||
(i64.const 52)
|
||||
)
|
||||
(f32.ne
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $isFinite<f32> (; 2 ;) (type $fi) (param $0 f32) (result i32)
|
||||
(return
|
||||
(i64.lt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(f64.promote/f32
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(i64.shr_u
|
||||
(i64.const -1)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(i64.shl
|
||||
(i64.const 2047)
|
||||
(i64.const 52)
|
||||
(f32.eq
|
||||
(f32.sub
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
(f32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $isNaN<f64> (; 3 ;) (type $Fi) (param $0 f64) (result i32)
|
||||
(return
|
||||
(i64.gt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.shr_u
|
||||
(i64.const -1)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(i64.shl
|
||||
(i64.const 2047)
|
||||
(i64.const 52)
|
||||
)
|
||||
(f64.ne
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $isFinite<f64> (; 4 ;) (type $Fi) (param $0 f64) (result i32)
|
||||
(return
|
||||
(i64.lt_u
|
||||
(i64.and
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
)
|
||||
(i64.shr_u
|
||||
(i64.const -1)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(i64.shl
|
||||
(i64.const 2047)
|
||||
(i64.const 52)
|
||||
(f64.eq
|
||||
(f64.sub
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
)
|
||||
(f64.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user