Skip to content

Commit

Permalink
Use liblumen_otp erlang://2 for __lumen_builtin_math.fdiv
Browse files Browse the repository at this point in the history
  • Loading branch information
KronicDeth committed Sep 30, 2020
1 parent 89d0f2f commit f91be44
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runtimes/core/src/builtins.rs
Expand Up @@ -23,6 +23,8 @@ extern "C" {
fn erlang_bxor_2(left: Term, right: Term) -> Term;
#[link_name = "erlang:div/2"]
fn erlang_div_2(dividend: Term, divisor: Term) -> Term;
#[link_name = "erlang://2"]
fn erlang_divide_2(dividend: Term, divisor: Term) -> Term;
}

#[export_name = "__lumen_builtin_bigint_from_cstr"]
Expand Down Expand Up @@ -224,7 +226,11 @@ pub extern "C" fn builtin_math_add(augend: Term, addend: Term) -> Term {

math_builtin!("__lumen_builtin_math.sub", builtin_math_sub, Sub, sub);
math_builtin!("__lumen_builtin_math.mul", builtin_math_mul, Mul, mul);
math_builtin!("__lumen_builtin_math.fdiv", builtin_math_fdiv, Div, div);

#[export_name = "__lumen_builtin_math.fdiv"]
pub extern "C" fn builtin_math_fdiv(dividend: Term, divisor: Term) -> Term {
unsafe { erlang_divide_2(dividend, divisor) }
}

#[export_name = "__lumen_builtin_math.div"]
pub extern "C" fn builtin_math_div(dividend: Term, divisor: Term) -> Term {
Expand Down

0 comments on commit f91be44

Please sign in to comment.