From 9efb959471d813be65e276249bb8ee8e1a74a0b1 Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 19 Apr 2021 15:26:41 +0100 Subject: [PATCH] bugfix, scheduler - fix bit counter specializations for 32 and 64 bits. --- lib/include/srsran/adt/bounded_bitset.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/include/srsran/adt/bounded_bitset.h b/lib/include/srsran/adt/bounded_bitset.h index cd4eb732d..afc099bc5 100644 --- a/lib/include/srsran/adt/bounded_bitset.h +++ b/lib/include/srsran/adt/bounded_bitset.h @@ -92,7 +92,7 @@ struct zerobit_counter { #ifdef __GNUC__ // clang and gcc /// Specializations for unsigned template -struct zerobit_counter { +struct zerobit_counter { static Integer msb_count(Integer value) { return (value) ? __builtin_clz(value) : std::numeric_limits::digits; @@ -102,19 +102,17 @@ struct zerobit_counter { return (value) ? __builtin_ctz(value) : std::numeric_limits::digits; } }; -#endif -#ifdef __GNUC__ // clang and gcc -/// Specializations for unsigned long +/// Specializations for unsigned long long template -struct zerobit_counter { +struct zerobit_counter { static Integer msb_count(Integer value) { - return (value) ? __builtin_clzl(value) : std::numeric_limits::digits; + return (value) ? __builtin_clzll(value) : std::numeric_limits::digits; } static Integer lsb_count(Integer value) { - return (value) ? __builtin_ctzl(value) : std::numeric_limits::digits; + return (value) ? __builtin_ctzll(value) : std::numeric_limits::digits; } }; #endif