7 #include "cln/integer.h"
15 #include "cln/integer_io.h"
16 #include "cln/exception.h"
21 bool logbitp (const cl_I& x, const cl_I& y)
25 // Falls x>=0: Falls x>=intDsize*Länge(y), teste Vorzeichen von y.
26 // Sonst x=intDsize*k+i, Teste Bit i vom Worte Nr. k+1 (von oben herab).
27 if (!minusp(x)) // x>=0 ?
29 { var uintV x_ = FN_to_V(x);
31 var const uintD* yLSDptr;
32 I_to_NDS_nocopy(y, ,ylen=,yLSDptr=,true, { return false; } ); // DS zu y
33 if (x_ < intDsize*ylen)
34 // x ist ein Fixnum >=0, < intDsize*ylen
35 { if (lspref(yLSDptr,floor(x_,intDsize)) & bit(x_%intDsize))
40 // Vorzeichen von y testen
48 { std::ostringstream buf;
49 fprint(buf, "logbitp: Index is negative: ");
51 throw runtime_exception(buf.str());