diff options
author | Dave Gauer <ratfactor@gmail.com> | 2022-09-06 08:08:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 08:08:03 -0400 |
commit | 687ff026956e024353afdfd3d9588aacb4454616 (patch) | |
tree | f353f775b1ab4dcb43cccc2de93aef45c86e4123 | |
parent | 971c76d4496c763e28d16560a1d52a13b3940688 (diff) | |
parent | 2c13601de07be5c980acb1c127f972f11acbdc9b (diff) | |
download | ziglings-687ff026956e024353afdfd3d9588aacb4454616.tar.gz ziglings-687ff026956e024353afdfd3d9588aacb4454616.tar.bz2 ziglings-687ff026956e024353afdfd3d9588aacb4454616.tar.xz ziglings-687ff026956e024353afdfd3d9588aacb4454616.zip |
Merge pull request #134 from BlueAlmost/bitreverse_comment
corrected @bitReverse for only 1 arg, instead of 2 args
-rw-r--r-- | exercises/064_builtins.zig | 5 | ||||
-rw-r--r-- | patches/patches/064_builtins.patch | 4 |
2 files changed, 4 insertions, 5 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 }); } diff --git a/patches/patches/064_builtins.patch b/patches/patches/064_builtins.patch index 06fa735..ebe313d 100644 --- a/patches/patches/064_builtins.patch +++ b/patches/patches/064_builtins.patch @@ -3,6 +3,6 @@ --- > const expected_result: u8 = 0b00010010; 88c88 -< const tupni: u8 = @bitReverse(input); +< const tupni: u8 = @bitReverse(input, tupni); --- -> const tupni: u8 = @bitReverse(u8, input); +> const tupni: u8 = @bitReverse(input); |