X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fbase%2Fdigitseq%2Fcl_2DS_div.cc;h=30eed3840c55b6fafeecd01ee05390f8f350228c;hb=22549ef70fee95faab1e9f2adaf710ba9e0bdabf;hp=997e3964ded3b7a051ca9a0e798e905c31aa49a0;hpb=c486b78a1a0613f07a10816d6f6ca9e485bc8290;p=cln.git diff --git a/src/base/digitseq/cl_2DS_div.cc b/src/base/digitseq/cl_2DS_div.cc index 997e396..30eed38 100644 --- a/src/base/digitseq/cl_2DS_div.cc +++ b/src/base/digitseq/cl_2DS_div.cc @@ -55,15 +55,15 @@ namespace cln { // // 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 @@ -93,15 +93,15 @@ namespace cln { // 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 @@ -124,7 +124,7 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L 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: @@ -141,9 +141,9 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L { // 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 @@ -157,7 +157,7 @@ void div2adic (uintC a_len, const uintD* a_LSDptr, uintC b_len, const uintD* b_L } } // 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); }