You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[test]
fn u32_pow() -> () {
disable_panic_on_overflow();
let x: u32 = 2;
let y: u32 = 64;
let z = x.pow(y); //this becomes 2**32, since u32 are essentially u64 under disguise, and explicit checks must be made to ensure values fall within range
assert(z == 0);
()
}
#[test]
fn u64_pow() -> () {
disable_panic_on_overflow();
let x: u64 = 2;
let y: u32 = 64;
let z = x.pow(y);
assert(z == 0);
()
}
pow may return results where the value is superior to the type maximum due to all primitive types of size < 8 bytes being treated as u64
The text was updated successfully, but these errors were encountered: