X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fmodinteger%2Fcl_MI_montgom.h;h=dba300805e34c6420632fdd51df3ecb3b3dcfec2;hb=22549ef70fee95faab1e9f2adaf710ba9e0bdabf;hp=c5c7a4cc1f02f13e87d50c42d105e6af172c0757;hpb=c84c6db5d56829d69083c819688a973867694a2a;p=cln.git diff --git a/src/modinteger/cl_MI_montgom.h b/src/modinteger/cl_MI_montgom.h index c5c7a4c..dba3008 100644 --- a/src/modinteger/cl_MI_montgom.h +++ b/src/modinteger/cl_MI_montgom.h @@ -135,7 +135,7 @@ static const cl_MI_x montgom_recip (cl_heap_modint_ring* _R, const _cl_MI& x) if (eq(g,1)) return cl_MI(R, mod((minusp(u) ? u + R->modulus : u) << (2*R->n), R->modulus)); if (zerop(xr)) - cl_error_division_by_0(); + throw division_by_0_exception(); return cl_notify_composite(R,xr); } @@ -149,7 +149,7 @@ static const cl_MI_x montgom_div (cl_heap_modint_ring* _R, const _cl_MI& x, cons if (eq(g,1)) return cl_MI(R, mod((x.rep * (minusp(u) ? u + R->modulus : u)) << R->n, R->modulus)); if (zerop(yr)) - cl_error_division_by_0(); + throw division_by_0_exception(); return cl_notify_composite(R,yr); } @@ -183,7 +183,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) CL_ALLOCA_STACK; var uintC len; var const uintD* M_LSDptr; - I_to_NDS_nocopy(M, ,len=,M_LSDptr=,cl_false,); + I_to_NDS_nocopy(M, ,len=,M_LSDptr=,false,); if (lspref(M_LSDptr,len-1)==0) { len--; } // normalize // Compute U as 2-adic inverse of M. var uintD* U_LSDptr; @@ -194,7 +194,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) var uintC i_min; var uintC i_max; var uintC i = floor(m,2); - var cl_boolean negative; + var bool negative; if (U_bit(i)) { for (; --i > 0; ) if (!U_bit(i)) break; @@ -203,7 +203,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) for (; ++i < m; ) if (!U_bit(i)) break; i_max = i; - negative = cl_true; + negative = true; } else { for (; --i > 0; ) if (U_bit(i)) break; @@ -212,7 +212,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) for (; ++i < m; ) if (U_bit(i)) break; i_max = i; - negative = cl_false; + negative = false; } #undef U_bit // OK, all the bits i_max-1..i_min of U are equal. @@ -230,7 +230,7 @@ static cl_heap_modint_ring* try_make_modint_ring_montgom (const cl_I& M) var cl_I U = DS_to_I(U_LSDptr lspop U_len,U_len); var cl_I V_N = 1 - U*M; if (ldb_test(V_N,cl_byte(n,0))) - cl_abort(); + throw runtime_exception(); var cl_I V = V_N >> n; return new cl_heap_modint_ring_montgom(M,m,n,V); }