Module malachite_base::num::arithmetic::mod_shr
source · Expand description
ModShr
and ModShrAssign
, traits for right-shifting
a number modulo another number.
§mod_shr
use malachite_base::num::arithmetic::traits::ModShr;
assert_eq!(10u8.mod_shr(2i64, 15), 2);
assert_eq!(8u32.mod_shr(-2i8, 10), 2);
§mod_shr_assign
use malachite_base::num::arithmetic::traits::ModShrAssign;
let mut n = 10u8;
n.mod_shr_assign(2i64, 15);
assert_eq!(n, 2);
let mut n = 8u32;
n.mod_shr_assign(-2i8, 10);
assert_eq!(n, 2);