mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-11-09 11:40:46 -05:00
Clarity for 062 and tupni for 064
This commit is contained in:
parent
77a8a123f7
commit
881db5eab2
4 changed files with 7 additions and 5 deletions
|
@ -24,6 +24,10 @@
|
||||||
// is probably not what you want. So consider the else clause
|
// is probably not what you want. So consider the else clause
|
||||||
// essential when using loops as expressions.
|
// essential when using loops as expressions.
|
||||||
//
|
//
|
||||||
|
// const four: u8 = while (true) {
|
||||||
|
// break 4;
|
||||||
|
// }; // <-- ERROR! Implicit 'else void' here!
|
||||||
|
//
|
||||||
// With that in mind, see if you can fix the problem with this
|
// With that in mind, see if you can fix the problem with this
|
||||||
// program.
|
// program.
|
||||||
//
|
//
|
||||||
|
|
|
@ -70,5 +70,5 @@ pub fn main() void {
|
||||||
// this builtin to reverse the bits of a u8 integer.
|
// this builtin to reverse the bits of a u8 integer.
|
||||||
const input: u8 = 0b11110000;
|
const input: u8 = 0b11110000;
|
||||||
const tupni: u8 = @bitReverse(input);
|
const tupni: u8 = @bitReverse(input);
|
||||||
print("{b:0>8} backwards is {b:0>8}.\n", .{input});
|
print("{b:0>8} backwards is {b:0>8}.\n", .{input, tupni});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
46c46
|
50c50
|
||||||
< };
|
< };
|
||||||
---
|
---
|
||||||
> } else null;
|
> } else null;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
72,73c72,73
|
72c72
|
||||||
< const tupni: u8 = @bitReverse(input);
|
< const tupni: u8 = @bitReverse(input);
|
||||||
< print("{b:0>8} backwards is {b:0>8}.\n", .{input});
|
|
||||||
---
|
---
|
||||||
> const tupni: u8 = @bitReverse(u8, input);
|
> const tupni: u8 = @bitReverse(u8, input);
|
||||||
> print("{b:0>8} backwards is {b:0>8}.\n", .{input, tupni});
|
|
||||||
|
|
Loading…
Reference in a new issue