ascii.cl: Cleanup on aisle "bitwise"

This commit is contained in:
John 2024-07-27 19:59:35 -05:00
parent 729155d3a4
commit 4295982876

View File

@ -8,9 +8,9 @@ fn main () {
fn n_digit(n: u32) -> char { fn n_digit(n: u32) -> char {
(if n > 9 { (if n > 9 {
n - 10 + ('a' as u32) ('a' as u32) + n - 10
} else { } else {
n + ('0' as u32) ('0' as u32) + n
}) as char }) as char
} }
@ -24,15 +24,14 @@ fn ascii() {
if col == 8 { if col == 8 {
print(' ') print(' ')
} }
let i = row * 16 + col print(n_digit(row), n_digit(col), ' ')
print(n_digit((i >> 4) & 0xf), n_digit(i & 0xf), ' ')
} }
print(" |") print(" ")
for col in 0..16 { for col in 0..16 {
let i = row * 16 + col let i = row << 4 | col
print(ascii_picture(i)) print(ascii_picture(i))
} }
println("|") println("")
} }
} }