init
This commit is contained in:
26
it_test.rs
Normal file
26
it_test.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
static mut I: i32 = 1;
|
||||
|
||||
fn iterator() -> i32 {
|
||||
unsafe {
|
||||
I = I << 1;
|
||||
I
|
||||
}
|
||||
}
|
||||
|
||||
fn print_binary(num: i32) {
|
||||
for shift in (0..32).rev() {
|
||||
print!("{}", (num >> shift) & 1);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut run = 1;
|
||||
while run != 0 {
|
||||
let next = iterator();
|
||||
println!("Int: {}", next);
|
||||
print!("Bin: ");
|
||||
print_binary(next);
|
||||
run = next;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user