From fac2151c56e94d843f1b7091367420f08a4b6db2 Mon Sep 17 00:00:00 2001
From: Emil Kitti <emil.kitti@outlook.com>
Date: Fri, 26 Jan 2018 19:18:19 +0100
Subject: [PATCH] bare0_3

---
 examples/bare0.rs | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/examples/bare0.rs b/examples/bare0.rs
index 4ab8495..f65ca9b 100644
--- a/examples/bare0.rs
+++ b/examples/bare0.rs
@@ -21,9 +21,9 @@ fn main() {
     let mut x = unsafe { X };
 
     loop {
-        x += 1;
+        x = x.wrapping_add(1);
         unsafe {
-            X += 1;
+            X = X.wrapping_add(1);
             Y = X;
             assert!(x == X && X == Y);
         }
@@ -70,10 +70,29 @@ fn main() {
 // 3. change += opertions to wrapping_add
 //    place a breakpoint at line 22
 //    load and run the progam, what happens
-//    ** your answer here **
+//
+//    Breakpoint 2, bare0::main () at examples/bare0.rs:24
+//    24	        x = x.wrapping_add(1);
+//    (gdb) print x
+//    $55 = 4294967295
+//    (gdb) next
+//    26	            X += 1;
+//    (gdb) print x
+//    $56 = 0
 //
 //    now continue exectution, what happens
-//    ** your answer here **
+//
+//    (gdb) print bare0::X
+//    $69 = 4294967295
+//    (gdb) next
+//    27	            Y = X;
+//    (gdb) print bare0::X
+//    $70 = 0
+//    (gdb) c
+//    Continuing.
+//
+//    Breakpoint 2, bare0::main () at examples/bare0.rs:24
+//    24	        x = x.wrapping_add(1);
 //
 //    commit your answers (bare0_3)
 //
-- 
GitLab