1 #include "tommath_private.h"
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* compare maginitude of two ints (unsigned) */
7 mp_ord mp_cmp_mag(const mp_int *a, const mp_int *b)
10 const mp_digit *tmpa, *tmpb;
12 /* compare based on # of non-zero digits */
13 if (a->used > b->used) {
17 if (a->used < b->used) {
22 tmpa = a->dp + (a->used - 1);
25 tmpb = b->dp + (a->used - 1);
27 /* compare based on digits */
28 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) {