From 48b5f3b399a51b96bc379ea18052374e64e5fec2 Mon Sep 17 00:00:00 2001 From: aletempiac Date: Thu, 29 Feb 2024 17:15:29 +0100 Subject: [PATCH] ACD66 performance improvements by avoiding unnecessary computation --- src/map/if/acd/acd66.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/if/acd/acd66.hpp b/src/map/if/acd/acd66.hpp index 92caf3b57..7d7a14faa 100644 --- a/src/map/if/acd/acd66.hpp +++ b/src/map/if/acd/acd66.hpp @@ -160,8 +160,10 @@ private: best_multiplicity = UINT32_MAX; best_free_set = UINT32_MAX; + uint32_t max_free_set = num_vars == 11 ? 5 : 4; + /* find ACD "66" for different number of variables in the free set */ - for ( uint32_t i = num_vars - 6; i <= 5; ++i ) + for ( uint32_t i = num_vars - 6; i <= max_free_set; ++i ) { if ( find_decomposition_bs( i ) ) return true; @@ -176,8 +178,10 @@ private: best_multiplicity = UINT32_MAX; best_free_set = UINT32_MAX; + uint32_t max_free_set = ( num_vars == 11 || offset == 5 ) ? 5 : 4; + /* find ACD "66" for different number of variables in the free set */ - for ( uint32_t i = std::max( num_vars - 6, offset ); i <= 5; ++i ) + for ( uint32_t i = std::max( num_vars - 6, offset ); i <= max_free_set; ++i ) { if ( find_decomposition_bs_offset( i, offset ) ) return true;