From 3faad6e17b03f13e91d4b93a525e6608c72c8ace Mon Sep 17 00:00:00 2001 From: Alexander Sisco <36649949+devspeare@users.noreply.github.com> Date: Sun, 2 Feb 2025 21:01:25 -0800 Subject: Suggesting a third exercise for bit manipulation --- build.zig | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index e528552..9774833 100644 --- a/build.zig +++ b/build.zig @@ -1208,6 +1208,38 @@ const exercises = [_]Exercise{ \\Max difference (new fn): 0.014 , }, + .{ .main_file = "110_bit_manipulation3.zig", .output = + \\Set pins with OR on PORTB + \\------------------------- + \\ 1001 // (initial state of PORTB) + \\| 0100 // (bitmask) + \\= 1101 + \\ + \\ 1001 // (reset state) + \\| 0100 // (bitmask) + \\= 1101 + \\ + \\Clear pins with AND and NOT on PORTB + \\------------------------------------ + \\ 1110 // (initial state of PORTB) + \\& 1011 // (bitmask) + \\= 1010 + \\ + \\ 0111 // (reset state) + \\& 1110 // (bitmask) + \\= 0110 + \\ + \\ + \\Toggle pins with XOR on PORTB + \\----------------------------- + \\ 1100 // (initial state of PORTB) + \\^ 0101 // (bitmask) + \\= 1001 + \\ + \\ 1100 // (initial state of PORTB) + \\^ 0011 // (bitmask) + \\= 1111 + }, .{ .main_file = "999_the_end.zig", .output = -- cgit v1.2.3