Coverage Report

Created: 2026-05-30 06:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/dropbear/libtommath/bn_mp_cmp_d.c
Line
Count
Source
1
#include "tommath_private.h"
2
#ifdef BN_MP_CMP_D_C
3
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
4
/* SPDX-License-Identifier: Unlicense */
5
6
/* compare a digit */
7
mp_ord mp_cmp_d(const mp_int *a, mp_digit b)
8
4.19M
{
9
   /* compare based on sign */
10
4.19M
   if (a->sign == MP_NEG) {
11
2.07M
      return MP_LT;
12
2.07M
   }
13
14
   /* compare based on magnitude */
15
2.11M
   if (a->used > 1) {
16
2.10M
      return MP_GT;
17
2.10M
   }
18
19
   /* compare the only digit of a to b */
20
13.3k
   if (a->dp[0] > b) {
21
2.60k
      return MP_GT;
22
10.7k
   } else if (a->dp[0] < b) {
23
5
      return MP_LT;
24
10.7k
   } else {
25
10.7k
      return MP_EQ;
26
10.7k
   }
27
13.3k
}
28
#endif