11 lines
248 B
Plaintext
11 lines
248 B
Plaintext
|
from "EMBED" import u8_to_bits;
|
||
|
|
||
|
def main(u8 i) -> field {
|
||
|
bool[8] bits = u8_to_bits(i);
|
||
|
field mut res = 0;
|
||
|
for u32 j in 0..8 {
|
||
|
u32 exponent = 8 - j - 1;
|
||
|
res = res + (bits[j] ? 2 ** exponent : 0);
|
||
|
}
|
||
|
return res;
|
||
|
}
|