pub const fn wrapping_mul(self, rhs: u64) -> u64
Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.
Examples: Please note that this example is shared between integer types. Which explains why u8 is used here.
assert_eq!(10u8.wrapping_mul(12), 120); // 10*12 mod 2^8 = 120
assert_eq!(25u8.wrapping_mul(12), 44); // 25*12 mod 2^8 = 300 mod 256 = 44
u32: 32-bit unsigned integer type
pub const fn wrapping_mul(self, rhs: u32) -> u32
Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary of the type.
Examples: Please note that this example is shared between integer types. Which explains why u8 is used here.
assert_eq!(10u8.wrapping_mul(12), 120); // 10*12 mod 2^8 = 120
assert_eq!(25u8.wrapping_mul(12), 44); // 25*12 mod 2^8 = 300 mod 256 = 44
参考资料: [1] https://doc.rust-lang.org/std/primitive.u32.html#method.wrapping_mul [2] https://doc.rust-lang.org/std/primitive.u64.html#method.wrapping_mul