aboutsummaryrefslogtreecommitdiff
path: root/exercises/064_builtins.zig
diff options
context:
space:
mode:
authorJames LeBlanc <james.p.leblanc@gmail.com>2022-09-03 10:56:25 +0200
committerJames LeBlanc <james.p.leblanc@gmail.com>2022-09-03 10:56:25 +0200
commit2c13601de07be5c980acb1c127f972f11acbdc9b (patch)
treeebbac0f1836820173342413d666bbcc5baafe3ea /exercises/064_builtins.zig
parenta723a4c1df3276b31733e13b16a33e859c831188 (diff)
downloadziglings-2c13601de07be5c980acb1c127f972f11acbdc9b.tar.gz
ziglings-2c13601de07be5c980acb1c127f972f11acbdc9b.tar.bz2
ziglings-2c13601de07be5c980acb1c127f972f11acbdc9b.tar.xz
ziglings-2c13601de07be5c980acb1c127f972f11acbdc9b.zip
corrected @bitReverse for only 1 arg, instead of 2 args
Diffstat (limited to 'exercises/064_builtins.zig')
-rw-r--r--exercises/064_builtins.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/exercises/064_builtins.zig b/exercises/064_builtins.zig
index 018bf95..1a0d263 100644
--- a/exercises/064_builtins.zig
+++ b/exercises/064_builtins.zig
@@ -76,8 +76,7 @@ pub fn main() void {
// Here's a fun one:
//
- // @bitReverse(comptime T: type, integer: T) T
- // * 'T' will be the type of the input and output.
+ // @bitReverse(integer: anytype) T
// * 'integer' is the value to reverse.
// * The return value will be the same type with the
// value's bits reversed!
@@ -85,6 +84,6 @@ pub fn main() void {
// 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);
+ const tupni: u8 = @bitReverse(input, tupni);
print("{b:0>8} backwards is {b:0>8}.\n", .{ input, tupni });
}