aboutsummaryrefslogtreecommitdiff
path: root/src/libtommath/s_mp_log_2expt.c
blob: ec0fda3b7da010960ff558c60a360969340032b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#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