Skip to content

Commit

Permalink
fmpz_CRT: make r2 and m2 parameters const
Browse files Browse the repository at this point in the history
  • Loading branch information
fagu committed Oct 21, 2023
1 parent aa90012 commit 4646859
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/source/fmpz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/fmpz.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *****************************************************************/

Expand Down
6 changes: 3 additions & 3 deletions src/fmpz/CRT.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 4646859

Please sign in to comment.