add bitwise functions for Int and Byte
@@ -438,6 +438,11 @@ pub fn load_byte(vm: &Thread) -> Result<ExternModule> {
record! {
min_value => std::byte::prim::min_value(),
max_value => std::byte::prim::max_value(),
+ shl => primitive!(2, <u8 as ::std::ops::Shl<u8>>::shl),
+ shr => primitive!(2, <u8 as ::std::ops::Shr<u8>>::shr),
+ bitxor => primitive!(2, <u8 as ::std::ops::BitXor<u8>>::bitxor),
+ bitand => primitive!(2, <u8 as ::std::ops::BitAnd<u8>>::bitand),
+ bitor => primitive!(2, <u8 as ::std::ops::BitOr<u8>>::bitor),
count_ones => primitive!(1, std::byte::prim::count_ones),
count_zeros => primitive!(1, std::byte::prim::count_zeros),
leading_zeros => primitive!(1, std::byte::prim::leading_zeros),
@@ -479,6 +484,12 @@ pub fn load_int(vm: &Thread) -> Result<ExternModule> {
"std.int.prim.from_str_radix",
|src, radix| std::int::prim::from_str_radix(src, radix).map_err(|_| ())
),
+ shl => primitive!(2, <i64 as ::std::ops::Shl<i64>>::shl),
+ arithmetic_shr => primitive!(2, <i64 as ::std::ops::Shr<i64>>::shr),
+ logical_shr => primitive!(2, <u64 as ::std::ops::Shr<u64>>::shr),
+ bitxor => primitive!(2, <i64 as ::std::ops::BitXor<i64>>::bitxor),
+ bitand => primitive!(2, <i64 as ::std::ops::BitAnd<i64>>::bitand),
+ bitor => primitive!(2, <i64 as ::std::ops::BitOr<i64>>::bitor),
count_ones => primitive!(1, std::int::prim::count_ones),
count_zeros => primitive!(1, std::int::prim::count_zeros),
leading_zeros => primitive!(1, std::int::prim::leading_zeros),
