mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Used negate instead of multiplying by -1 for INT_ABS implementation
This commit is contained in:
parent
c435cd2a19
commit
198716498c
1 changed files with 3 additions and 3 deletions
|
@ -131,10 +131,10 @@ fn int_abs(var_store: &VarStore) -> Def {
|
|||
no_region(Var(Symbol::INT_ABS_ARG)),
|
||||
)],
|
||||
final_else: Box::new(
|
||||
// int is below 0, so multiply it by -1
|
||||
// int is below 0, so negate it.
|
||||
no_region(call(
|
||||
Symbol::NUM_MUL,
|
||||
vec![Var(Symbol::INT_ABS_ARG), Int(var_store.fresh(), -1)],
|
||||
Symbol::NUM_NEG,
|
||||
vec![Var(Symbol::INT_ABS_ARG)],
|
||||
var_store,
|
||||
)),
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue