Module malachite_base::num::arithmetic::mod_shl
source · Expand description
ModShl
and ModShlAssign
, traits for left-shifting
a number modulo another number.
§mod_shl
use malachite_base::num::arithmetic::traits::ModShl;
assert_eq!(8u32.mod_shl(2u8, 10), 2);
assert_eq!(10u8.mod_shl(100u64, 17), 7);
assert_eq!(8u32.mod_shl(2i8, 10), 2);
assert_eq!(10u8.mod_shl(-2i64, 15), 2);
§mod_shl_assign
use malachite_base::num::arithmetic::traits::ModShlAssign;
let mut n = 8u32;
n.mod_shl_assign(2u8, 10);
assert_eq!(n, 2);
let mut n = 10u8;
n.mod_shl_assign(100u64, 17);
assert_eq!(n, 7);
let mut n = 8u32;
n.mod_shl_assign(2i8, 10);
assert_eq!(n, 2);
let mut n = 10u8;
n.mod_shl_assign(-2i64, 15);
assert_eq!(n, 2);