From 4295982876c6b717ce57e71aba5043a52f21f678 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 27 Jul 2024 19:59:35 -0500 Subject: [PATCH] ascii.cl: Cleanup on aisle "bitwise" --- sample-code/ascii.cl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sample-code/ascii.cl b/sample-code/ascii.cl index 0660d82..7be5dbf 100755 --- a/sample-code/ascii.cl +++ b/sample-code/ascii.cl @@ -8,9 +8,9 @@ fn main () { fn n_digit(n: u32) -> char { (if n > 9 { - n - 10 + ('a' as u32) + ('a' as u32) + n - 10 } else { - n + ('0' as u32) + ('0' as u32) + n }) as char } @@ -24,15 +24,14 @@ fn ascii() { if col == 8 { print(' ') } - let i = row * 16 + col - print(n_digit((i >> 4) & 0xf), n_digit(i & 0xf), ' ') + print(n_digit(row), n_digit(col), ' ') } - print(" |") + print(" │") for col in 0..16 { - let i = row * 16 + col + let i = row << 4 | col print(ascii_picture(i)) } - println("|") + println("│") } }