fDegree, vDegree = gf_degree(f), gf_degree(v)
res, rem = 0, f
- i = fDegree
- mask = 1 << i
- while (i >= vDegree):
- if (mask & rem): # check MSB
+ for i in reversed(range(vDegree, fDegree+1):
+ if ((rem >> i) & 1): # check bit
res ^= (1 << (i - vDegree))
rem ^= ( v << (i - vDegree)))
- i -= 1
- mask >>= 1
return (res, rem)
```
+
| 0.5|6.10|11.15|16.20| 21 | 22.23 | 24....30 |31| name |
| -- | -- | --- | --- | -- | ----- | -------- |--| ---- |
| NN | RT | RA | RB | 1 | 00 | 0001 110 |Rc| cldiv |
| NN | RT | RA | RB | 1 | 01 | 0001 110 |Rc| clmod |
-GFMOD is a pseudo-op where RA=0
-
## carryless mul
based on RV bitmanip