diff --git a/README.md b/README.md index 2076c63..1cd15ea 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # e-antic +## (Real Embedded) Algebraic Number Theory -The e-antic package +e-antic is a C/C++/Python library to deal with real embedded number fields +built on top of [ANTIC](https://github.com/wbhart/antic). Its aim is to have +as fast as possible exact arithmetic operations and comparisons. diff --git a/e-antic-cmp.patch b/e-antic-cmp.patch new file mode 100644 index 0000000..01844be --- /dev/null +++ b/e-antic-cmp.patch @@ -0,0 +1,30 @@ +--- a/libeantic/srcxx/renf_elem_class.cpp 2021-08-15 05:18:03.000000000 -0600 ++++ b/libeantic/srcxx/renf_elem_class.cpp 2021-09-22 12:07:20.608651581 -0600 +@@ -1048,11 +1048,11 @@ bool operator==(const renf_elem_class& l + } + + bool operator<(const renf_elem_class& lhs, long rhs) { +- return renf_elem_cmp_si(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) == -1; ++ return renf_elem_cmp_si(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) < 0; + } + + bool operator>(const renf_elem_class& lhs, long rhs) { +- return renf_elem_cmp_si(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) == 1; ++ return renf_elem_cmp_si(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) > 0; + } + + renf_elem_class& renf_elem_class::operator+=(unsigned long rhs) +@@ -1084,11 +1084,11 @@ bool operator==(const renf_elem_class& l + } + + bool operator<(const renf_elem_class& lhs, unsigned long rhs) { +- return renf_elem_cmp_ui(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) == -1; ++ return renf_elem_cmp_ui(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) < 0; + } + + bool operator>(const renf_elem_class& lhs, unsigned long rhs) { +- return renf_elem_cmp_ui(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) == 1; ++ return renf_elem_cmp_ui(lhs.renf_elem_t(), rhs, lhs.nf->renf_t()) > 0; + } + + renf_elem_class& renf_elem_class::operator+=(long long rhs) diff --git a/e-antic-negative-int.patch b/e-antic-negative-int.patch deleted file mode 100644 index 27730a9..0000000 --- a/e-antic-negative-int.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libeantic/test/renfxx/t-cmp.cpp 2021-06-25 08:06:12.000000000 -0600 -+++ b/libeantic/test/renfxx/t-cmp.cpp 2021-07-16 11:49:56.363242945 -0600 -@@ -94,7 +94,7 @@ TEMPLATE_TEST_CASE("Relational Operators - const auto& K = GENERATE_REF(take(16, renf_classs(state))); - - auto a = GENERATE_REF(take(8, renf_elem_classs(state, K))); -- T b = GENERATE(0, std::numeric_limits::min(), std::numeric_limits::max()); -+ T b = GENERATE(0, 0, std::numeric_limits::max()); - - check_relop(a, b); - } diff --git a/e-antic-odr.patch b/e-antic-odr.patch new file mode 100644 index 0000000..1edf863 --- /dev/null +++ b/e-antic-odr.patch @@ -0,0 +1,21 @@ +Fix this warning: + +../e-antic/renf_elem_class.hpp:213:48: warning: 'renf_elem_t' violates the C++ One Definition Rule [-Wodr] + 213 | std::add_lvalue_reference_t<::renf_elem_t> renf_elem_t() const; + | ^ +renf_elem_class.cpp:661:17: note: return value type mismatch + 661 | ::renf_elem_t & renf_elem_class::renf_elem_t() const + | ^ +renf_elem_class.cpp:661:17: note: 'renf_elem_t' was previously declared here + +--- a/libeantic/srcxx/renf_elem_class.cpp 2021-08-15 05:18:03.000000000 -0600 ++++ b/libeantic/srcxx/renf_elem_class.cpp 2021-08-30 08:27:39.214354014 -0600 +@@ -658,7 +658,7 @@ bool renf_elem_class::is_rational() cons + return renf_elem_is_rational(a, nf->renf_t()); + } + +-::renf_elem_t & renf_elem_class::renf_elem_t() const ++std::add_lvalue_reference_t<::renf_elem_t> renf_elem_class::renf_elem_t() const + { + return a; + } diff --git a/e-antic.spec b/e-antic.spec index 1ebb164..6b61590 100644 --- a/e-antic.spec +++ b/e-antic.spec @@ -10,9 +10,11 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # have already been incorporated into the Fedora versions. Make e-antic skip # attempts to build the patched files. Patch0: %{name}-unpatch.patch -# Work around a comparison bug with negative integers on 32-bit platforms. +# Fix the comparison operator. # https://github.com/flatsurf/e-antic/issues/194 -Patch1: %{name}-negative-int.patch +Patch1: %{name}-cmp.patch +# Fix a One Definition Rule violation. +Patch2: %{name}-odr.patch BuildRequires: antic-devel BuildRequires: arb-devel @@ -108,6 +110,10 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} make check %{_libdir}/libeanticxx.so %changelog +* Fri Jan 14 2022 Jerry James - 1.0.3-2 +- Replace -negative-int patch with better -cmp patch +- Add -odr patch + * Wed Aug 25 2021 Jerry James - 1.0.3-2 - Rebuild for flint 2.8.0