Optimize some std mem methods by replacing expensive rem operations to fast bit logic (#24)

This commit is contained in:
Max Graey
2018-02-12 19:47:32 +02:00
committed by Daniel Wirtz
parent 74f8189ac1
commit 2175e6fbdc
8 changed files with 193 additions and 172 deletions

View File

@ -109,13 +109,13 @@
(local $4 i32)
(loop $continue|0
(if
(if (result i32)
(get_local $2)
(i32.rem_u
(select
(i32.and
(get_local $1)
(i32.const 4)
(i32.const 3)
)
(get_local $2)
(get_local $2)
)
(block
(set_local $0
@ -154,9 +154,9 @@
)
(if
(i32.eqz
(i32.rem_u
(i32.and
(get_local $0)
(i32.const 4)
(i32.const 3)
)
)
(block
@ -358,9 +358,9 @@
(block $tablify|0
(br_table $case0|2 $case1|2 $case2|2 $tablify|0
(i32.sub
(i32.rem_u
(i32.and
(get_local $0)
(i32.const 4)
(i32.const 3)
)
(i32.const 1)
)
@ -1729,21 +1729,21 @@
(block
(if
(i32.eq
(i32.rem_u
(i32.and
(get_local $1)
(i32.const 8)
(i32.const 7)
)
(i32.rem_u
(i32.and
(get_local $0)
(i32.const 8)
(i32.const 7)
)
)
(block
(loop $continue|0
(if
(i32.rem_u
(i32.and
(get_local $0)
(i32.const 8)
(i32.const 7)
)
(block
(if
@ -1865,24 +1865,24 @@
(block
(if
(i32.eq
(i32.rem_u
(i32.and
(get_local $1)
(i32.const 8)
(i32.const 7)
)
(i32.rem_u
(i32.and
(get_local $0)
(i32.const 8)
(i32.const 7)
)
)
(block
(loop $continue|3
(if
(i32.rem_u
(i32.and
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 8)
(i32.const 7)
)
(block
(if