#include "cln/modinteger.h"
#include "cln/GV_integer.h"
#include "cl_DS.h"
-#include "cln/abort.h"
+#include "cln/exception.h"
namespace cln {
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);
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)
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?
// 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());
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;