Macaulay2 Engine
Loading...
Searching...
No Matches

◆ subtract_multiple()

void M2::ARingZZp::subtract_multiple ( elem & result,
elem a,
elem b ) const
inline

Definition at line 247 of file aring-zzp.hpp.

248 {
249 // we assume: a, b are NONZERO!!
250 // result -= a*b
251
252 // the change in code below mimics that of coeffrings.cpp which was 15-20% faster in
253 // testing for some reason (in small characteristics). The assembly generated is much more
254 // clean than it was previously.
255
256 //int ab = a + b;
257 //if (ab > p1) ab -= p1;
258 int ab = modulus_add(a,b,p1);
259 //int n = exp_table[result] - exp_table[ab];
260 //if (n < 0) n += p;
261 int n = modulus_sub(exp_table[result],exp_table[ab],p);
262 result = log_table[n];
263 }
int modulus_add(int a, int b, int p) const
int modulus_sub(int a, int b, int p) const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References exp_table, log_table, modulus_add(), modulus_sub(), p, p1, and result().