diff --git a/examples/bare0.rs b/examples/bare0.rs index 3be74e1d3cc80aad2c62c3fe0a1fb1568f9229a1..606ac0fac1c2e12fadddf005d6fd4e65628b8b49 100644 --- a/examples/bare0.rs +++ b/examples/bare0.rs @@ -19,7 +19,7 @@ extern crate panic_halt; use cortex_m_rt::entry; // a constant (cannot be changed at run-time) -const X_INIT: u32 = 10; +const X_INIT: u32 = 0xffffffff; // global mutabale variables (changed using unsafe code) static mut X: u32 = X_INIT; @@ -31,9 +31,9 @@ fn main() -> ! { let mut x = unsafe { X }; loop { - x += 1; // <- place breakpoint here (3) + x.wrapping_add(1); // <- place breakpoint here (3) unsafe { - X += 1; + X.wrapping_add(1); Y = X; assert!(x == X && X == Y); } @@ -75,10 +75,10 @@ fn main() -> ! { // // Change (both) += opertions to use wrapping_add // load and run the progam, what happens -// ** your answer here ** +// ** x value stays at u32 max 4294967295** // // Now continue exectution, what happens -// ** your answer here ** +// ** X,Y and x = 4294967295 ** // // Commit your answers (bare0_3) //