From ae25601ab28a306614dfaddc76a256f318b9d4ad Mon Sep 17 00:00:00 2001 From: pjanevski Date: Mon, 28 Oct 2024 08:53:41 +0000 Subject: [PATCH] cpp nits --- tests/test_utils/soc_desc_test_utils.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/test_utils/soc_desc_test_utils.hpp b/tests/test_utils/soc_desc_test_utils.hpp index e966418c..bb3f8166 100644 --- a/tests/test_utils/soc_desc_test_utils.hpp +++ b/tests/test_utils/soc_desc_test_utils.hpp @@ -8,14 +8,9 @@ namespace test_utils { static std::size_t get_num_harvested(std::size_t harvesting_mask) { - std::size_t num_harvested = 0; - while (harvesting_mask > 0) { - if (harvesting_mask & 1) { - num_harvested++; - } - harvesting_mask >>= 1; - } - return num_harvested; + // Counts the number of 1 bits in harvesting mask, effectively representing + // the number of harvested rows (Wormhole) or columns (Blackhole). + return __builtin_popcount(harvesting_mask); } }