From 43ea1392f205690283308d6a5d11386a5d808f26 Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Thu, 27 Jul 2017 19:22:23 +0100 Subject: [PATCH] bignum: rename bn_maxdigitcount to bn_digitcount This reverts commit 5dbdf18b6c2ef1d95a7787bd57ab1e1126f439c0. --- bignum.c | 2 +- bignum.h | 2 +- test_check.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bignum.c b/bignum.c index 8c33d7038c..caca7b6078 100644 --- a/bignum.c +++ b/bignum.c @@ -999,7 +999,7 @@ size_t bn_format(const bignum256 *amnt, const char *prefix, const char *suffix, BN_FORMAT_PUSH(0); } - unsigned int digits = bn_maxdigitcount(&val); + unsigned int digits = bn_digitcount(&val); for (unsigned int i = 0; i < digits / 3; i++) { uint32_t limb; bn_divmod1000(&val, &limb); diff --git a/bignum.h b/bignum.h index 30d4ba0ef0..ec64094f32 100644 --- a/bignum.h +++ b/bignum.h @@ -83,7 +83,7 @@ static inline void bn_copy(const bignum256 *a, bignum256 *b) { int bn_bitcount(const bignum256 *a); -static inline int bn_maxdigitcount(const bignum256 *a) +static inline int bn_digitcount(const bignum256 *a) { int bitcount = bn_bitcount(a); diff --git a/test_check.c b/test_check.c index 80aadc5305..bdd0f671f0 100644 --- a/test_check.c +++ b/test_check.c @@ -391,7 +391,7 @@ START_TEST(test_bignum_digitcount) bignum256 a; bn_zero(&a); - ck_assert_int_eq(bn_maxdigitcount(&a), 1); + ck_assert_int_eq(bn_digitcount(&a), 1); // test for 10000 and 99999 when i=5 for (int i = 1; i <= 19; i++) { @@ -402,19 +402,19 @@ START_TEST(test_bignum_digitcount) n = n * 10 + 9; } bn_read_uint64(m, &a); - ck_assert_int_eq(bn_maxdigitcount(&a), i); + ck_assert_int_eq(bn_digitcount(&a), i); bn_read_uint64(n, &a); - ck_assert_int_eq(bn_maxdigitcount(&a), i + 1); + ck_assert_int_eq(bn_digitcount(&a), i); } bn_read_uint32(0x3fffffff, &a); - ck_assert_int_eq(bn_maxdigitcount(&a), 10); + ck_assert_int_eq(bn_digitcount(&a), 10); bn_read_uint32(0xffffffff, &a); - ck_assert_int_eq(bn_maxdigitcount(&a), 10); + ck_assert_int_eq(bn_digitcount(&a), 10); bn_read_be(fromhex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"), &a); - ck_assert_int_eq(bn_maxdigitcount(&a), 78); + ck_assert_int_eq(bn_digitcount(&a), 78); } END_TEST