mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-06-08 07:50:00 +00:00
Suggesting a third exercise for bit manipulation
This commit is contained in:
32
build.zig
32
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 =
|
||||
|
||||
Reference in New Issue
Block a user