summaryrefslogtreecommitdiffstats
path: root/mpi/mpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpi/mpi.c')
-rw-r--r--mpi/mpi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mpi/mpi.c b/mpi/mpi.c
index 355a8d1f..0d5e0beb 100644
--- a/mpi/mpi.c
+++ b/mpi/mpi.c
@@ -4037,7 +4037,7 @@ mp_size s_mp_ispow2(mp_int *v)
{
mp_digit d, *dp;
mp_size uv = USED(v);
- mp_size extra = 0, ix;
+ mp_size ix;
d = DIGIT(v, uv - 1); /* most significant digit of v */
@@ -4045,8 +4045,6 @@ mp_size s_mp_ispow2(mp_int *v)
if ((d & (d - 1)) != 0)
return MP_SIZE_MAX; /* not a power of two */
- extra = s_highest_bit(d) - 1;
-
if (uv >= 2) {
ix = uv - 2;
dp = DIGITS(v) + ix;
@@ -4059,7 +4057,7 @@ mp_size s_mp_ispow2(mp_int *v)
}
}
- return ((uv - 1) * DIGIT_BIT) + extra;
+ return ((uv - 1) * DIGIT_BIT) + s_highest_bit(d) - 1;
}
int s_mp_ispow2d(mp_digit d)