From 4646859b8744e113ddeb135bb6fbc8391a19f789 Mon Sep 17 00:00:00 2001 From: Fabian Gundlach Date: Sat, 21 Oct 2023 15:55:41 +0200 Subject: [PATCH] fmpz_CRT: make r2 and m2 parameters const --- doc/source/fmpz.rst | 2 +- src/fmpz.h | 2 +- src/fmpz/CRT.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/source/fmpz.rst b/doc/source/fmpz.rst index 786a987a3a..ce51926a15 100644 --- a/doc/source/fmpz.rst +++ b/doc/source/fmpz.rst @@ -1288,7 +1288,7 @@ The ``fmpz_multi_CRT`` class is similar to ``fmpz_multi_CRT_ui`` except that it If sign = 0, it is assumed that `0 \le r_1 < m_1` and `0 \le r_2 < m_2`. Otherwise, it is assumed that `-m_1 \le r_1 < m_1` and `0 \le r_2 < m_2`. -.. function:: void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, fmpz_t r2, fmpz_t m2, int sign) +.. function:: void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, const fmpz_t r2, const fmpz_t m2, int sign) Use the Chinese Remainder Theorem to set ``out`` to the unique value `0 \le x < M` (if sign = 0) or `-M/2 < x \le M/2` (if sign = 1) diff --git a/src/fmpz.h b/src/fmpz.h index c21d3368c8..24fa59ca94 100644 --- a/src/fmpz.h +++ b/src/fmpz.h @@ -621,7 +621,7 @@ void fmpz_fib_ui(fmpz_t f, ulong n); void _fmpz_CRT_ui_precomp(fmpz_t out, const fmpz_t r1, const fmpz_t m1, ulong r2, ulong m2, mp_limb_t m2inv, const fmpz_t m1m2, mp_limb_t c, int sign); void fmpz_CRT_ui(fmpz_t out, const fmpz_t r1, const fmpz_t m1, ulong r2, ulong m2, int sign); -void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, fmpz_t r2, fmpz_t m2, int sign); +void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, const fmpz_t r2, const fmpz_t m2, int sign); /* multi CRT *****************************************************************/ diff --git a/src/fmpz/CRT.c b/src/fmpz/CRT.c index 146f028342..669a61b4b4 100644 --- a/src/fmpz/CRT.c +++ b/src/fmpz/CRT.c @@ -16,8 +16,8 @@ #include "fmpz.h" void -_fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, fmpz_t r2, - fmpz_t m2, const fmpz_t m1m2, fmpz_t c, int sign) +_fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, const fmpz_t r2, + const fmpz_t m2, const fmpz_t m1m2, fmpz_t c, int sign) { fmpz_t r1normal, tmp, r1mod, s; @@ -65,7 +65,7 @@ _fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, fmpz_t r2, } void fmpz_CRT(fmpz_t out, const fmpz_t r1, const fmpz_t m1, - fmpz_t r2, fmpz_t m2, int sign) + const fmpz_t r2, const fmpz_t m2, int sign) { fmpz_t m1m2, c;