LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_cmp.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 4 8 50.0 %
Date: 2024-06-13 04:01:37 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "tommath_private.h"
       2             : #ifdef BN_MP_CMP_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* compare two ints (signed)*/
       7      110554 : mp_ord mp_cmp(const mp_int *a, const mp_int *b)
       8             : {
       9             :    /* compare based on sign */
      10      110554 :    if (a->sign != b->sign) {
      11           0 :       if (a->sign == MP_NEG) {
      12           0 :          return MP_LT;
      13             :       } else {
      14           0 :          return MP_GT;
      15             :       }
      16             :    }
      17             : 
      18             :    /* compare digits */
      19      110554 :    if (a->sign == MP_NEG) {
      20             :       /* if negative compare opposite direction */
      21           0 :       return mp_cmp_mag(b, a);
      22             :    } else {
      23      110554 :       return mp_cmp_mag(a, b);
      24             :    }
      25             : }
      26             : #endif

Generated by: LCOV version 1.13