//
// Break-even-point. When in doubt, prefer to choose the standard algorithm.
#if CL_USE_GMP
- static inline cl_boolean cl_recip_suitable (uintC m, uintC n) // n <= m
+ static inline bool cl_recip_suitable (uintC m, uintC n) // n <= m
{ if (n < 2000)
- return cl_false;
+ return false;
else // when n >= 4400/(m/n)^2, i.e. (m/66)^2 > n
{ var uintC mq = floor(m,66);
if ((mq >= bit(intCsize/2)) || (mq*mq > n))
- return cl_true;
+ return true;
else
- return cl_false;
+ return false;
}
}
#else
// 1.8*N / N : Newton for N >= 500
// 1.9*N / N : Newton for N >= 500
// 2.0*N / N : Newton for N >= 500
- static inline cl_boolean cl_recip_suitable (uintC m, uintC n) // n <= m
+ static inline bool cl_recip_suitable (uintC m, uintC n) // n <= m
{ if (n < 500)
- return cl_false;
+ return false;
else // when n >= 2100/(m/n)^2, i.e. (m/46)^2 > n
{ var uintC mq = floor(m,46);
if ((mq >= bit(intCsize/2)) || (mq*mq > n))
- return cl_true;
+ return true;
else
- return cl_false;
+ return false;
}
}
#endif
var uintD* p_LSDptr;
num_stack_alloc(2*b_len,,p_LSDptr=);
cl_UDS_mul(q_LSDptr,b_len,b_LSDptr,b_len,p_LSDptr);
- // Überprüfen, daß p == a mod 2^(intDsize*b_len):
+ // Überprüfen, daß p == a mod 2^(intDsize*b_len):
if (compare_loop_msp(a_LSDptr lspop b_len,p_LSDptr lspop b_len,b_len))
throw runtime_exception();
// Quotient q und "Rest" (a-b*q)/2^(intDsize*b_len) ablegen:
{ // Standard division.
var uintD b0inv = div2adic(1,lspref(b_LSDptr,0)); // b'
copy_loop_lsp(a_LSDptr,dest_LSDptr,a_len); // d := a
- do { var uintD digit = lspref(dest_LSDptr,0); // nächstes d[j]
+ do { var uintD digit = lspref(dest_LSDptr,0); // nächstes d[j]
digit = mul2adic(b0inv,digit);
- // digit = nächstes c[j]
+ // digit = nächstes c[j]
if (a_len <= b_len)
{ mulusub_loop_lsp(digit,b_LSDptr,dest_LSDptr,a_len); } // d := d - b * c[j] * beta^j
else
} }
// Nun ist lspref(dest_LSDptr,0) = 0.
lspref(dest_LSDptr,0) = digit; // c[j] ablegen
- lsshrink(dest_LSDptr); a_len--; // nächstes j
+ lsshrink(dest_LSDptr); a_len--; // nächstes j
}
until (a_len==lendiff);
}