aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-09-27 08:17:24 -0400
committerJack Lloyd <[email protected]>2019-09-27 08:17:24 -0400
commit9f200f78ada27297cac67e025e5d9e2251da7da0 (patch)
tree5aeba2a2796b9438a5dee7b8bf6eb76d5bde233a /src/cli
parent88d6a1e35bd8fc978933d1e2633d34fc4e5fed12 (diff)
Fix small bug in is_prime speed test
We were testing p instead of p + i as intended. Also change the loop induction to work around what appears to be a lgtm false positive.
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/speed.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 8361243dc..d5a23f08c 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -1611,9 +1611,9 @@ class Speed final : public Command
}
// Now test p+2, p+4, ... which may or may not be prime
- for(size_t i = 2; i != 64; i += 2)
+ for(size_t i = 2; i <= 64; i += 2)
{
- is_prime_timer->run([&]() { Botan::is_prime(p, rng(), 64, true); });
+ is_prime_timer->run([&]() { Botan::is_prime(p + i, rng(), 64, true); });
}
}