code wiki / (root) / nx_fec_gf256.nx

nx_fec_gf256.nx

buildroot/runtime/nx_fec_gf256.nx

5871 B173 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic fec
docsdependenciesstructsconstsfunctions

about

nx_fec_gf256.nx -- the FEC CEILING: Reed-Solomon erasure coding over GF(256). MDS (maximum-distance-separable): an RS(n=K+R, K) code recovers ANY R lost symbols, in ANY positions -- not just the specific patterns XOR parity handles. This is the DSN/CCSDS/RaptorQ-class rateless recovery ceiling. Sovereign, integer-only: GF(256) tables are BUILT AT RUNTIME from the primitive polynomial 0x11D (sidesteps the const-array-literal gap, same trick as nx_crc32c), and a CAUCHY parity matrix guarantees every K x K submatrix is invertible (true MDS). Encoding matrix = [ I_K ; C ] where C[j][i] = 1 / ((K+j) ^ i) in GF(256) (disjoint Cauchy point sets -> non-singular). Decode: take the K rows for any K surviving symbols -> K x K matrix M -> data = M^-1 * survivors (Gauss-Jordan over GF(256)). Reconstructs every erased symbol. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_fec_gf256.nx nx_fec_gf256_test.nx

imports: nx_syscalls.nx

imported by: nx_fec_gf256_test.nx

structs

none

consts

19const GF_POLY: i64 = 0x11D // x^8+x^4+x^3+x^2+1, generator 2

functions

22func gf_build(exp: *i64, log: *i64) -> i64
called by 1: main
36func gf_mul(exp: *i64, log: *i64, a: i64, b: i64) -> i64
41func gf_inv(exp: *i64, log: *i64, a: i64) -> i64 { return exp[255 - log[a]] }
43func rs_cauchy(exp: *i64, log: *i64, j: i64, i: i64, K: i64) -> i64
called by 2: rs_encoders_decode_erasures calls 1: gf_inv
48func rs_encode(exp: *i64, log: *i64, data: *u8, K: i64, R: i64, S: i64, parity: *u8) -> i64
called by 1: main calls 2: rs_cauchygf_mul
70func gf_mat_invert(exp: *i64, log: *i64, M: *i64, K: i64, Minv: *i64) -> i64
127func rs_decode_erasures(exp: *i64, log: *i64, recv: *u8, present: *i64,