X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Finteger%2Fbitwise%2Fcl_I_logtest.cc;h=14e6b8f5ccac0c57b22c4e524b1fbbc4536e1c97;hb=665c18cd376d8d8c5a8eafb30681a3f9f46d4a99;hp=cb2d93773cb18d222a985d927a31db9566683a3e;hpb=6fdd87f5e762926b273583db2d6440862584596f;p=cln.git diff --git a/src/integer/bitwise/cl_I_logtest.cc b/src/integer/bitwise/cl_I_logtest.cc index cb2d937..14e6b8f 100644 --- a/src/integer/bitwise/cl_I_logtest.cc +++ b/src/integer/bitwise/cl_I_logtest.cc @@ -14,12 +14,12 @@ namespace cln { -cl_boolean logtest (const cl_I& x, const cl_I& y) +bool logtest (const cl_I& x, const cl_I& y) { // Methode: // Fixnums separat behandeln. - // Sei oBdA x die kürzere der beiden Zahlen (in Digits). - // x echt kürzer und x<0 -> [eines der most signif. intDsize+1 Bits von y ist 1] Ja. + // Sei oBdA x die kürzere der beiden Zahlen (in Digits). + // x echt kürzer und x<0 -> [eines der most signif. intDsize+1 Bits von y ist 1] Ja. // Beide gleich lang oder x>=0 -> // Kann mich auf die untersten length(x) Digits beschraenken. // Mit AND durchlaufen, abbrechen (mit "Ja") falls /=0. Am Ende: Nein. @@ -27,42 +27,42 @@ cl_boolean logtest (const cl_I& x, const cl_I& y) if (fixnump(y)) // beides Fixnums { if ((x.word & y.word & cl_combine(0,~(cl_uint)0))==0) - return cl_false; + return false; else - return cl_true; + return true; } else - // x Fixnum, y Bignum, also ist x echt kürzer - { if (FN_V_minusp(x,FN_to_V(x))) return cl_true; // x<0 -> ja. + // x Fixnum, y Bignum, also ist x echt kürzer + { if (FN_V_minusp(x,FN_to_V(x))) return true; // x<0 -> ja. // x>=0. Kombiniere x mit den pFN_maxlength letzten Digits von y. {var const uintD* yLSDptr; var uintV x_ = FN_to_V(x); BN_to_NDS_nocopy(y, ,,yLSDptr=); #if (pFN_maxlength > 1) doconsttimes(pFN_maxlength-1, - if (lsprefnext(yLSDptr) & (uintD)x_) return cl_true; + if (lsprefnext(yLSDptr) & (uintD)x_) return true; x_ = x_ >> intDsize; ); #endif - if (lsprefnext(yLSDptr) & (uintD)x_) return cl_true; - return cl_false; + if (lsprefnext(yLSDptr) & (uintD)x_) return true; + return false; }} else if (fixnump(y)) // x Bignum, y Fixnum, analog wie oben, nur x und y vertauscht - { if (FN_V_minusp(y,FN_to_V(y))) return cl_true; // y<0 -> ja. + { if (FN_V_minusp(y,FN_to_V(y))) return true; // y<0 -> ja. // y>=0. Kombiniere y mit den pFN_maxlength letzten Digits von x. {var const uintD* xLSDptr; var uintV y_ = FN_to_V(y); BN_to_NDS_nocopy(x, ,,xLSDptr=); #if (pFN_maxlength > 1) doconsttimes(pFN_maxlength-1, - if (lsprefnext(xLSDptr) & (uintD)y_) return cl_true; + if (lsprefnext(xLSDptr) & (uintD)y_) return true; y_ = y_ >> intDsize; ); #endif - if (lsprefnext(xLSDptr) & (uintD)y_) return cl_true; - return cl_false; + if (lsprefnext(xLSDptr) & (uintD)y_) return true; + return false; }} else // x,y Bignums @@ -76,17 +76,17 @@ cl_boolean logtest (const cl_I& x, const cl_I& y) if (!(xlen==ylen)) // beide verschieden lang { if (xlen