]> www.ginac.de Git - cln.git/blobdiff - src/polynomial/elem/cl_UP_GF2.h
Cater to the fact that g++ 4.3 will use a different naming for
[cln.git] / src / polynomial / elem / cl_UP_GF2.h
index fa2c5b123fc9f668ae5e1d0d84554d27af3be4fb..0fb5e658eb4a4bf06ea15a86d7e14262c66c208f 100644 (file)
@@ -4,7 +4,7 @@
 #include "cln/modinteger.h"
 #include "cln/GV_integer.h"
 #include "cl_DS.h"
-#include "cln/abort.h"
+#include "cln/exception.h"
 
 namespace cln {
 
@@ -13,7 +13,7 @@ struct cl_heap_GV_I_bits1 : public cl_heap_GV_I {
        uintD data[1];
 };
 
-static cl_boolean gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y)
+static bool gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y)
 {{
        DeclarePoly(cl_GV_MI,x);
        DeclarePoly(cl_GV_MI,y);
@@ -23,12 +23,12 @@ static cl_boolean gf2_equal (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const
        var uintL xlen = xv->v.length();
        var uintL ylen = yv->v.length();
        if (!(xlen == ylen))
-               return cl_false;
+               return false;
        // We can compare full words since unused bits in the last word are 0.
        var uintL count = ceiling(xlen,intDsize);
        if (compare_loop_up(xv->data,yv->data,count) != 0)
-               return cl_false;
-       return cl_true;
+               return false;
+       return true;
 }}
 
 static const _cl_UP gf2_plus (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const _cl_UP& y)
@@ -95,7 +95,7 @@ static const _cl_UP gf2_uminus (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
        return x;
 }
 
-#if !(defined(__sparc__) || defined(__sparc64__))
+#if !defined(__sparc__) || defined(__sparc64__)
 // Multiplication of polynomials over GF(2) can unfortunately not profit
 // from hardware multiply instructions. Use a table instead.
 // This is a 2^8 x 2^4 table. Maybe a 2^6 x 2^6 table would be better?
@@ -966,7 +966,7 @@ static const _cl_UP gf2_square (cl_heap_univpoly_ring* UPR, const _cl_UP& x)
 // Scalar multiplication of GF(2)-polynomials is trivial: 0*y = 0, 1*y = y.
 static const _cl_UP gf2_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_element& x, const _cl_UP& y)
 {
-       if (!(UPR->basering() == x.ring())) cl_abort();
+       if (!(UPR->basering() == x.ring())) throw runtime_exception();
  {
        DeclarePoly(_cl_MI,x);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
@@ -981,7 +981,7 @@ static const _cl_UP gf2_scalmul (cl_heap_univpoly_ring* UPR, const cl_ring_eleme
 static const cl_ring_element gf2_eval (cl_heap_univpoly_ring* UPR, const _cl_UP& x, const cl_ring_element& y)
 {{
        DeclarePoly(cl_GV_MI,x);
-       if (!(UPR->basering() == y.ring())) cl_abort();
+       if (!(UPR->basering() == y.ring())) throw runtime_exception();
   {    DeclarePoly(_cl_MI,y);
        var cl_heap_modint_ring* R = TheModintRing(UPR->basering());
        var const cl_heap_GV_I_bits1 * xv = (const cl_heap_GV_I_bits1 *) x.heappointer;