LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_incr.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 16 0.0 %
Date: 2024-04-21 15:09:00 Functions: 0 1 0.0 %

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

Generated by: LCOV version 1.14