push
travis-ci
asn1: function ptrs passed as ASN1CALL ptrs must be ASN1CALL On Windows i386 the asn1 tests would crash due to stack corruption as a result of functions being executed with the wrong calling conventions. Change-Id: Ic4f8b3a05
76888 of 145819 relevant lines covered (52.73%)
889479.8 hits per line
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)
|
4,203,508✔ |
8 |
{ |
|
9 |
/* compare based on sign */
|
|
10 |
if (a->sign == MP_NEG) {
|
4,203,508✔ |
11 |
return MP_LT;
|
× |
12 |
} |
|
13 |
|
|
14 |
/* compare based on magnitude */
|
|
15 |
if (a->used > 1) { |
4,203,508✔ |
16 |
return MP_GT;
|
4,168,552✔ |
17 |
} |
|
18 |
|
|
19 |
/* compare the only digit of a to b */
|
|
20 |
if (a->dp[0] > b) { |
34,956✔ |
21 |
return MP_GT;
|
14,107✔ |
22 |
} else if (a->dp[0] < b) { |
20,849✔ |
23 |
return MP_LT;
|
16,186✔ |
24 |
} else {
|
|
25 |
return MP_EQ;
|
4,663✔ |
26 |
} |
|
27 |
} |
|
28 |
#endif
|