summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_divmod.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-07-23 16:43:57 +0000
committerLaurent Bercot <ska@appnovation.com>2021-07-23 16:43:57 +0000
commitdd6bb6c6b8298ebeff2d1882becb36580b969d6f (patch)
tree3d922a5791e7e34e2b041ea5f3489360bfa798e1 /src/libbiguint/bu_divmod.c
parent122f9363682e5de8ce4056c4c05c1eaf8935cf19 (diff)
downloadskalibs-dd6bb6c6b8298ebeff2d1882becb36580b969d6f.tar.xz
New 2.11.0.0 branch with several modifications
- libbiguint removed - cdb_make changed to cdbmake (because different ui) - cdb redesigned Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libbiguint/bu_divmod.c')
-rw-r--r--src/libbiguint/bu_divmod.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/libbiguint/bu_divmod.c b/src/libbiguint/bu_divmod.c
deleted file mode 100644
index 17b6b7b..0000000
--- a/src/libbiguint/bu_divmod.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ISC license. */
-
-#include <errno.h>
-#include <skalibs/biguint.h>
-
-/*
- q = y/x mod m.
-*/
-
-int bu_divmod (uint32_t *q, unsigned int qn, uint32_t const *y, unsigned int yn, uint32_t const *x, unsigned int xn, uint32_t const *m, unsigned int mn)
-{
- unsigned int ylen = bu_len(y, yn) ;
- unsigned int xlen = bu_len(x, xn) ;
- unsigned int mlen = bu_len(m, mn) ;
- unsigned int n = ylen ;
- if (n < xlen) n = xlen ;
- if (n < mlen) n = mlen ;
- if (!n) return (errno = EDOM, 0) ;
- {
- uint32_t yy[n] ;
- uint32_t xx[n] ;
- uint32_t mm[n] ;
- bu_gcd(xx, n, x, xlen, m, mlen) ;
- if ((xx[0] != 1) || (bu_len(xx, n) != 1)) return (errno = EDOM, 0) ;
- bu_copy_internal(yy, y, ylen) ; bu_zero(yy+ylen, n-ylen) ;
- bu_copy_internal(xx, x, xlen) ; bu_zero(xx+xlen, n-xlen) ;
- bu_copy_internal(mm, m, mlen) ; bu_zero(mm+mlen, n-mlen) ;
- bu_divmod_internal(yy, xx, mm, n) ;
- return bu_copy(q, qn, yy, n) ;
- }
-}