mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-13 21:40:46 -05:00
19 lines
830 B
Diff
19 lines
830 B
Diff
--- exercises/064_builtins.zig 2023-10-03 22:15:22.125574535 +0200
|
|
+++ answers/064_builtins.zig 2023-10-05 20:04:07.132768316 +0200
|
|
@@ -63,7 +63,7 @@
|
|
//
|
|
// If there was no overflow at all while adding 5 to a, what value would
|
|
// 'my_result' hold? Write the answer in into 'expected_result'.
|
|
- const expected_result: u8 = ???;
|
|
+ const expected_result: u8 = 0b00010010;
|
|
print(". Without overflow: {b:0>8}. ", .{expected_result});
|
|
|
|
print("Furthermore, ", .{});
|
|
@@ -78,6 +78,6 @@
|
|
// Now it's your turn. See if you can fix this attempt to use
|
|
// this builtin to reverse the bits of a u8 integer.
|
|
const input: u8 = 0b11110000;
|
|
- const tupni: u8 = @bitReverse(input, tupni);
|
|
+ const tupni: u8 = @bitReverse(input);
|
|
print("{b:0>8} backwards is {b:0>8}.\n", .{ input, tupni });
|
|
}
|