]> www.ginac.de Git - cln.git/blobdiff - src/modinteger/cl_MI_rshift.cc
Replace unused macro with cl_unused.
[cln.git] / src / modinteger / cl_MI_rshift.cc
index 09400fb1c233557df3097576be3116f2248d4e15..a4fec8b1aef601ad36143cf327ab4be30aff8250 100644 (file)
@@ -1,26 +1,28 @@
 // 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);
        }
@@ -35,8 +37,10 @@ const cl_MI operator>> (const cl_MI& x, sintL y) // assume 0 <= y < 2^31
        // 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