summaryrefslogtreecommitdiff
path: root/transpose.py
blob: c2db0c54244a6a28bd0eee7ebda6256896ca8e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import sys

chars = []
with open(sys.argv[1], "rb") as f:
    print("const uint8_t c64_chars[512][8] = {")
    
    while char := f.read(8):
        transposed = [0] * 8
        for i in range(8):
            for j in range(8):
                bit = char[i] & (0b1000000 >> j)
                bit <<= j

                transposed[j] |= bit >> i

        joined = ", ".join(str(t) for t in transposed)
        print(f"  {{{joined}}},")

    print("};")