mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
use much faster __builtin_clz
This commit is contained in:
parent
9f07a27eaf
commit
41fa2c7f40
1 changed files with 4 additions and 0 deletions
|
|
@ -398,10 +398,14 @@ GaloisFieldReference<M, POLY, TYPE> rcp(GaloisFieldReference<M, POLY, TYPE> a)
|
|||
TYPE newr = a.P, r = a.v;
|
||||
TYPE newt = 0, t = 1;
|
||||
auto degree = [](TYPE a) {
|
||||
#if 1
|
||||
return 31 - __builtin_clz(a);
|
||||
#else
|
||||
int d = 0;
|
||||
while (a >>= 1)
|
||||
++d;
|
||||
return d;
|
||||
#endif
|
||||
};
|
||||
int k = degree(r);
|
||||
int j = M - k;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue