2019-09-27 01:40:08 +00:00
|
|
|
#include "tommath_private.h"
|
2019-10-19 14:24:39 +00:00
|
|
|
#ifdef MP_PACK_COUNT_C
|
2019-09-27 01:40:08 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
|
|
|
|
2019-10-09 18:22:11 +00:00
|
|
|
size_t mp_pack_count(const mp_int *a, size_t nails, size_t size)
|
2019-09-27 01:40:08 +00:00
|
|
|
{
|
|
|
|
size_t bits = (size_t)mp_count_bits(a);
|
|
|
|
return ((bits / ((size * 8u) - nails)) + (((bits % ((size * 8u) - nails)) != 0u) ? 1u : 0u));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|