int GF::compare_elems(const ring_elem f, const ring_elem g) const { int cmp = f.get_int() - g.get_int(); if (cmp < 0) return -1; if (cmp == 0) return 0; return 1; }
void GF::elem_text_out(buffer &o, const ring_elem a, bool p_one, bool p_plus, bool p_parens) const { if (a.get_int() == _ZERO) { o << "0"; return; } ring_elem h = _originalR->power(_primitive_element->get_value(), a.int_val); _originalR->elem_text_out(o, h, p_one, p_plus, p_parens); _originalR->remove(h); }
void GF::internal_negate_to(ring_elem &f) const { if (f.get_int() != _ZERO) f = modulus_add(f.get_int(), _MINUS_ONE, Q1_); }
bool GF::is_equal(const ring_elem f, const ring_elem g) const { return f.get_int() == g.get_int(); }
bool GF::is_zero(const ring_elem f) const { return (f.get_int() == _ZERO); }
bool GF::is_unit(const ring_elem f) const { return (f.get_int() != _ZERO); }