Use liblumen_otp erlang:bsl/2 for __lumen_builtin_math.bsl
The version in liblumen_otp has badarith handling.
@@ -15,6 +15,8 @@ extern "C" {
fn erlang_band_2(left: Term, right: Term) -> Term;
#[link_name = "erlang:bor/2"]
fn erlang_bor_2(left: Term, right: Term) -> Term;
+ #[link_name = "erlang:bsl/2"]
+ fn erlang_bsl_2(integer: Term, shift: Term) -> Term;
}
#[export_name = "__lumen_builtin_bigint_from_cstr"]
@@ -220,7 +222,12 @@ math_builtin!("__lumen_builtin_math.fdiv", builtin_math_fdiv, Div, div);
integer_math_builtin!("__lumen_builtin_math.div", builtin_math_div, div);
integer_math_builtin!("__lumen_builtin_math.rem", builtin_math_rem, rem);
-integer_math_builtin!("__lumen_builtin_math.bsl", builtin_math_bsl, shl);
+
+#[export_name = "__lumen_builtin_math.bsl"]
+pub extern "C" fn builtin_math_bsl(integer: Term, shift: Term) -> Term {
+ unsafe { erlang_bsl_2(integer, shift) }
+}
+
integer_math_builtin!("__lumen_builtin_math.bsr", builtin_math_bsr, shr);
#[export_name = "__lumen_builtin_math.band"]
