064_builtins.patch 830 B

12345678910111213141516171819
  1. --- exercises/064_builtins.zig 2023-10-03 22:15:22.125574535 +0200
  2. +++ answers/064_builtins.zig 2023-10-05 20:04:07.132768316 +0200
  3. @@ -63,7 +63,7 @@
  4. //
  5. // If there was no overflow at all while adding 5 to a, what value would
  6. // 'my_result' hold? Write the answer in into 'expected_result'.
  7. - const expected_result: u8 = ???;
  8. + const expected_result: u8 = 0b00010010;
  9. print(". Without overflow: {b:0>8}. ", .{expected_result});
  10. print("Furthermore, ", .{});
  11. @@ -78,6 +78,6 @@
  12. // Now it's your turn. See if you can fix this attempt to use
  13. // this builtin to reverse the bits of a u8 integer.
  14. const input: u8 = 0b11110000;
  15. - const tupni: u8 = @bitReverse(input, tupni);
  16. + const tupni: u8 = @bitReverse(input);
  17. print("{b:0>8} backwards is {b:0>8}.\n", .{ input, tupni });
  18. }