// m > 0, m = 2^m1
+namespace cln {
+
class cl_heap_modint_ring_pow2 : public cl_heap_modint_ring {
SUBCLASS_cl_heap_modint_ring()
public:
// Constructor.
- cl_heap_modint_ring_pow2 (const cl_I& m, uintL m1); // m = 2^m1
- // Virtual destructor.
+ cl_heap_modint_ring_pow2 (const cl_I& m, uintC m1); // m = 2^m1
+ // Destructor.
~cl_heap_modint_ring_pow2 () {}
// Additional information.
- uintL m1;
+ uintC m1;
};
-static
-#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 90)) // workaround g++-2.7.2 and egcs-1.0.2-prerelease bug
-inline
-#endif
-const cl_I pow2_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x)
+static inline const cl_I pow2_reduce_modulo (cl_heap_modint_ring* _R, const cl_I& x)
{
var cl_heap_modint_ring_pow2* R = (cl_heap_modint_ring_pow2*)_R;
return ldb(x,cl_byte(R->m1,0));
if (R->m1 == 0)
return cl_MI(R, 0);
if (zerop(xr))
- cl_error_division_by_0();
+ throw division_by_0_exception();
else
return cl_notify_composite(R,xr);
} else
if (R->m1 == 0)
return cl_MI(R, 0);
if (zerop(yr))
- cl_error_division_by_0();
+ throw division_by_0_exception();
else
return cl_notify_composite(R,yr);
} else
std_retract
};
+static void cl_modint_ring_pow2_destructor (cl_heap* pointer)
+{
+ (*(cl_heap_modint_ring_pow2*)pointer).~cl_heap_modint_ring_pow2();
+}
+
+cl_class cl_class_modint_ring_pow2 = {
+ cl_modint_ring_pow2_destructor,
+ cl_class_flags_modint_ring
+};
+
// Constructor.
-inline cl_heap_modint_ring_pow2::cl_heap_modint_ring_pow2 (const cl_I& m, uintL _m1)
- : cl_heap_modint_ring (m, &std_setops, &pow2_addops, &pow2_mulops), m1 (_m1) {}
+inline cl_heap_modint_ring_pow2::cl_heap_modint_ring_pow2 (const cl_I& m, uintC _m1)
+ : cl_heap_modint_ring (m, &std_setops, &pow2_addops, &pow2_mulops), m1 (_m1)
+{
+ type = &cl_class_modint_ring_pow2;
+}
+
+} // namespace cln