LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_decr.c (source / functions) Hit Total Coverage
Test: coverage report for support-claim-type-attributes 6b5c566e Lines: 0 19 0.0 %
Date: 2023-11-21 12:31:41 Functions: 0 1 0.0 %

          Line data    Source code
       1             : #include "tommath_private.h"
       2             : #ifdef BN_MP_DECR_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* Decrement "a" by one like "a--". Changes input! */
       7           0 : mp_err mp_decr(mp_int *a)
       8             : {
       9           0 :    if (MP_IS_ZERO(a)) {
      10           0 :       mp_set(a,1uL);
      11           0 :       a->sign = MP_NEG;
      12           0 :       return MP_OKAY;
      13           0 :    } else if (a->sign == MP_NEG) {
      14           0 :       mp_err err;
      15           0 :       a->sign = MP_ZPOS;
      16           0 :       if ((err = mp_incr(a)) != MP_OKAY) {
      17           0 :          return err;
      18             :       }
      19             :       /* There is no -0 in LTM */
      20           0 :       if (!MP_IS_ZERO(a)) {
      21           0 :          a->sign = MP_NEG;
      22             :       }
      23           0 :       return MP_OKAY;
      24           0 :    } else if (a->dp[0] > 1uL) {
      25           0 :       a->dp[0]--;
      26           0 :       if (a->dp[0] == 0u) {
      27           0 :          mp_zero(a);
      28             :       }
      29           0 :       return MP_OKAY;
      30             :    } else {
      31           0 :       return mp_sub_d(a, 1uL,a);
      32             :    }
      33             : }
      34             : #endif

Generated by: LCOV version 1.14