summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_invmod.c
blob: ff209e75c398a51463a152810045231583a99b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* ISC license. */

#include <skalibs/uint32.h>
#include <skalibs/biguint.h>

/* x^-1 mod m. */

int bu_invmod (uint32 *x, unsigned int xn, uint32 const *m, unsigned int mn)
{
  uint32 const one = 1 ;
  return bu_divmod(x, xn, &one, 1, x, xn, m, mn) ;
}