Skip to content

Commit

Permalink
chore: Avoid branch prediction on 164abs
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Oct 4, 2024
1 parent da0054a commit d98433b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stdlib/runtime/numbers.gr
Original file line number Diff line number Diff line change
Expand Up @@ -1602,8 +1602,9 @@ let numberDivide = (x, y) => {

@unsafe
let i64abs = x => {
use WasmI64.{ (-), (>=) }
if (x >= 0N) x else 0N - x
use WasmI64.{ (^), (>>), (-) }
let mask = x >> 31N
(x ^ mask) - mask
}

@unsafe
Expand Down

0 comments on commit d98433b

Please sign in to comment.