t8-mod/deps/libtommath/s_mp_log_2expt.c

13 lines
326 B
C
Raw Normal View History

2024-02-15 15:46:47 -05:00
#include "tommath_private.h"
#ifdef S_MP_LOG_2EXPT_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
int s_mp_log_2expt(const mp_int *a, mp_digit base)
{
int y;
for (y = 0; (base & 1) == 0; y++, base >>= 1) {}
return (mp_count_bits(a) - 1) / y;
}
#endif