Bump actions/upload-artifacts version
[libtommath.git] / mp_cmp_d.c
blob42f7b1600e2b8495c04c4f219fd37d19adf54d94
1 #include "tommath_private.h"
2 #ifdef MP_CMP_D_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* compare a digit */
7 mp_ord mp_cmp_d(const mp_int *a, mp_digit b)
9 /* compare based on sign */
10 if (mp_isneg(a)) {
11 return MP_LT;
14 /* compare based on magnitude */
15 if (a->used > 1) {
16 return MP_GT;
19 /* compare the only digit of a to b */
20 if (a->dp[0] != b) {
21 return a->dp[0] > b ? MP_GT : MP_LT;
24 return MP_EQ;
26 #endif