diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-07-23 16:43:57 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2021-07-23 16:43:57 +0000 |
commit | dd6bb6c6b8298ebeff2d1882becb36580b969d6f (patch) | |
tree | 3d922a5791e7e34e2b041ea5f3489360bfa798e1 /src/libbiguint/bu_divmod_internal.c | |
parent | 122f9363682e5de8ce4056c4c05c1eaf8935cf19 (diff) | |
download | skalibs-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_internal.c')
-rw-r--r-- | src/libbiguint/bu_divmod_internal.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/libbiguint/bu_divmod_internal.c b/src/libbiguint/bu_divmod_internal.c deleted file mode 100644 index afb8ccc..0000000 --- a/src/libbiguint/bu_divmod_internal.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ISC license. */ - -#include <skalibs/biguint.h> - -/* - u = u/a mod m. a and m must be relatively prime - otherwise, infinite loop. - a is not immutable. - Original idea by Sheueling Chang Shantz of Sun Research. -*/ - -void bu_divmod_internal (uint32_t *u, uint32_t *a, uint32_t const *m, unsigned int n) -{ - uint32_t bb[n] ; uint32_t *b = bb ; - uint32_t vv[n] ; uint32_t *v = vv ; - bu_copy_internal(b, m, n) ; - bu_zero(v, n) ; - - /*** XXX: this iterates like mad, should probably be optimized more */ - for (;;) - { - while (!(a[0] & 1)) - { - bu_srb(a, n) ; - if (u[0] & 1) bu_add(u, n, u, n, m, n) ; - bu_srb(u, n) ; - } - if ((a[0] == 1) && (bu_len(a, n) == 1)) break ; - if (bu_cmp(a, n, b, n) < 0) - { - uint32_t *t = a ; a = b ; b = t ; - t = u ; u = v ; v = t ; - } - bu_add(a, n, a, n, b, n) ; - bu_add(u, n, u, n, v, n) ; - } -} |