// operator>> on cl_MI.
// General includes.
-#include "cl_sysdep.h"
+#include "base/cl_sysdep.h"
// Specification.
-#include "cl_modinteger.h"
+#include "cln/modinteger.h"
// Implementation.
-#include "cl_integer.h"
-#include "cl_N.h"
-#include "cl_MI.h"
+#include "cln/integer.h"
+#include "cln/exception.h"
+#include "modinteger/cl_MI.h"
-const cl_MI operator>> (const cl_MI& x, sintL y) // assume 0 <= y < 2^31
+namespace cln {
+
+const cl_MI operator>> (const cl_MI& x, sintC y) // assume 0 <= y < 2^(intCsize-1)
{
if (y == 0)
return x;
var const cl_modint_ring& R = x.ring();
if (!oddp(R->modulus)) {
if (R->modulus == 2)
- cl_error_division_by_0();
+ throw division_by_0_exception();
else
return (cl_MI_x)cl_notify_composite(R,2);
}
// Use algorithm 1 for small y, algorithm 2 for large y.
#if 0
if (y <= 2*R->bits)
- cl_abort(); // not yet implemented
+ throw runtime_exception(); // not yet implemented
else
#endif
return R->div(x, expt_pos(R->canonhom(2), (cl_I)(long)y));
}
+
+} // namespace cln