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
use std;
fn main() {
let i : u32 = (1u32 << 32u32);
std::io::println(#fmt("%d", i as int));
}
This prints 25187856 on my setup. If, on the other hand, I do something more like this:
use std;
fn main() {
let s : u32 = 0u32;
while (s < 40u32) {
let i : u32 = (1u32 << s);
std::io::println(
#fmt("shift: %d, result: %d", s as int, i as int));
s = s + 1u32;
}
}
then I get Java-like behavior; in particular one of the lines is:
shift: 32, result: 1
which totally doesn't match what happened with the shift by a literal!