From ceefe5d2696877842c1325749c2dc8b8b16a5354 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 2 Jun 2021 21:24:04 +0200 Subject: [PATCH] Lift function call out of inner loop Signed-off-by: Gilles Peskine --- tests/suites/test_suite_mpi.function | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/suites/test_suite_mpi.function b/tests/suites/test_suite_mpi.function index a2d312f6af..58079841c5 100644 --- a/tests/suites/test_suite_mpi.function +++ b/tests/suites/test_suite_mpi.function @@ -1530,6 +1530,8 @@ void mpi_random_many( int min, data_t *bound_bytes, int iterations ) } else { + int statistically_safe_all_the_way = + is_significantly_above_a_power_of_2( bound_bytes ); for( b = 0; b < n_bits; b++ ) { mbedtls_test_set_step( 1000000 + b ); @@ -1541,8 +1543,7 @@ void mpi_random_many( int min, data_t *bound_bytes, int iterations ) * As an exception, the top bit may legitimately never be set * if bound is a power of 2 or only slightly above. */ - if( b != n_bits - 1 || - is_significantly_above_a_power_of_2( bound_bytes ) ) + if( statistically_safe_all_the_way || b != n_bits - 1 ) { TEST_ASSERT( stats[b] > 0 ); }