1 /* TomsFastMath, a fast ISO C bignum library.
3 * This project is meant to fill in where LibTomMath
4 * falls short. That is speed ;-)
6 * This project is public domain and free for all purposes.
8 * Tom St Denis, tomstdenis@gmail.com
10 #include <tfm_private.h>
12 static const int lnz[16] = {
13 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
16 /* Counts the number of lsbs which are zero before the first zero bit */
17 int fp_cnt_lsb(fp_int *a)
23 if (fp_iszero(a) == 1) {
27 /* scan lower digits until non-zero */
28 for (x = 0; x < a->used && a->dp[x] == 0; x++);
32 /* now scan this digit until a 1 is found */