@@ -84,14 +84,16 @@ constexpr std::pair<std::array<int16_t, 1023>, std::array<int16_t, 1024>> Genera
84
84
85
85
// Each element v of GF(1024) is encoded as a 10 bit integer in the following way:
86
86
// v = v1 || v0 where v0, v1 are 5-bit integers (elements of GF(32)).
87
- // The element (e) is encoded as 9 || 15. Given (v), we
88
- // compute (e)*(v) by multiplying in the following way:
87
+ // The element (e) is encoded as 1 || 0, to represent 1*(e) + 0. Every other element
88
+ // a*(e) + b is represented as a || b (a and b are both GF(32) elements). Given (v),
89
+ // we compute (e)*(v) by multiplying in the following way:
89
90
//
90
- // v0' = 27 *v1 + 15*v0
91
- // v1' = 6 *v1 + 9* v0
91
+ // v0' = 23 *v1
92
+ // v1' = 9 *v1 + v0
92
93
// e*v = v1' || v0'
93
94
//
94
- // Multiplication in GF(32) is done using the log/exp tables:
95
+ // Where 23, 9 are GF(32) elements encoded as described above. Multiplication in GF(32)
96
+ // is done using the log/exp tables:
95
97
// e^x * e^y = e^(x + y) so a * b = EXP[ LOG[a] + LOG [b] ]
96
98
// for non-zero a and b.
97
99
@@ -100,10 +102,8 @@ constexpr std::pair<std::array<int16_t, 1023>, std::array<int16_t, 1024>> Genera
100
102
int v0 = v & 31 ;
101
103
int v1 = v >> 5 ;
102
104
103
- int v0n = (v1 ? GF32_EXP.at ((GF32_LOG.at (v1) + GF32_LOG.at (27 )) % 31 ) : 0 ) ^
104
- (v0 ? GF32_EXP.at ((GF32_LOG.at (v0) + GF32_LOG.at (15 )) % 31 ) : 0 );
105
- int v1n = (v1 ? GF32_EXP.at ((GF32_LOG.at (v1) + GF32_LOG.at (6 )) % 31 ) : 0 ) ^
106
- (v0 ? GF32_EXP.at ((GF32_LOG.at (v0) + GF32_LOG.at (9 )) % 31 ) : 0 );
105
+ int v0n = v1 ? GF32_EXP.at ((GF32_LOG.at (v1) + GF32_LOG.at (23 )) % 31 ) : 0 ;
106
+ int v1n = (v1 ? GF32_EXP.at ((GF32_LOG.at (v1) + GF32_LOG.at (9 )) % 31 ) : 0 ) ^ v0;
107
107
108
108
v = v1n << 5 | v0n;
109
109
GF1024_EXP[i] = v;
0 commit comments