mirror of
https://github.com/circify/circ.git
synced 2026-04-21 03:00:54 -04:00
11 lines
212 B
Plaintext
11 lines
212 B
Plaintext
def u8log2(u8 x) -> u8:
|
|
u8 acc = 0x00
|
|
for field i in 0..8 do
|
|
acc = acc + if x != 0x00 then 0x01 else 0x00 fi
|
|
x = x >> 1
|
|
endfor
|
|
return acc
|
|
|
|
def main(private u8 x) -> u8:
|
|
return x + u8log2(x)
|