Fix gf_tables.py

The C file has been manually modified and does not match what is
autogenerated, this brings it back into sync.
This commit is contained in:
Joshua Leahy
2025-09-04 12:43:44 +00:00
parent be5ebc6a79
commit 05799dc1ed
+5 -3
View File
@@ -5,7 +5,9 @@ POLY = 0x11B # x^8 + x^4 + x^3 + x + 1, or 100011011
GENERATOR = 0x03 # x + 1, or 00000011
print('// generated with gf_tables.py')
print('#ifndef __KERNEL__')
print('#include <stdint.h>')
print('#endif')
print()
def gf_mul(x, y):
@@ -21,7 +23,7 @@ def gf_mul(x, y):
return out
# Exp table
print('extern const uint8_t gf_exp_table[256] = {', end='')
print('const uint8_t rs_gf_exp_table[256] = {', end='')
exp_table = [0]*256
x = 1
for i in range(256):
@@ -37,7 +39,7 @@ log_table = {}
log_table[0] = 0
for a, b in enumerate(exp_table):
log_table[b] = a
print('extern const uint8_t gf_log_table[256] = {', end='')
print('const uint8_t rs_gf_log_table[256] = {', end='')
for i in range(256):
if i % 16 == 0:
print('\n ', end='')
@@ -46,7 +48,7 @@ print('\n};\n')
# Inv table
inv_table = [0]*256
print('extern const uint8_t gf_inv_table[256] = {', end='')
print('const uint8_t rs_gf_inv_table[256] = {', end='')
for i in range(256):
if i == 0:
x = 0