summaryrefslogtreecommitdiff
path: root/src/libbiguint/bu_div_internal.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_div_internal.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_div_internal.c')
-rw-r--r--src/libbiguint/bu_div_internal.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/libbiguint/bu_div_internal.c b/src/libbiguint/bu_div_internal.c
deleted file mode 100644
index 0765a99..0000000
--- a/src/libbiguint/bu_div_internal.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/biguint.h>
-
-/*
- q = a/b, a = a mod b. Assumes b != 0 and qn >= alen - blen + 1.
-*/
-
-void bu_div_internal (uint32_t *a, unsigned int an, uint32_t const *b, unsigned int bn, uint32_t *q, unsigned int qn)
-{
- unsigned int alen = bu_len(a, an) ;
- unsigned int blen = bu_len(b, bn) ;
- bu_zero(q, qn) ;
- if (alen < blen) return ;
- {
- uint32_t bb[alen + 1] ;
- unsigned int i = 1 + ((alen - blen) << 5) ;
- bu_zero(bb, alen - blen) ;
- bu_copy_internal(bb + alen - blen, b, blen) ;
- bb[alen] = 0 ;
-
- while (bu_cmp(a, alen, bb, alen+1) >= 0)
- {
- bu_slb(bb + alen - blen, blen + 1) ;
- i++ ;
- }
- while (i && (bu_cmp(a, alen, bb, alen+1) < 0))
- {
- bu_srb(bb, alen + 1) ;
- i-- ;
- }
-
- while (i--)
- {
- bu_slb(q, alen - blen + 1) ;
- if (bu_cmp(a, alen, bb, alen) >= 0)
- {
- bu_sub(a, alen, a, alen, bb, alen) ;
- q[0] |= 1 ;
- }
- bu_srb(bb, alen) ;
- }
- }
-}