X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fcm%2Fcommon_def.c;h=0faff3997faf8b8e3acfde0b4c8d53989a0ae6b7;hb=64580b61ab517a3c1fc09b3e0dc32109b913b726;hp=897360df4be69b4d1cd2a400366d4cfccf4ebf43;hpb=f1832987a80e584b5b4d821d3d4cec54ba2c4677;p=o-du%2Fl2.git diff --git a/src/cm/common_def.c b/src/cm/common_def.c index 897360df4..0faff3997 100644 --- a/src/cm/common_def.c +++ b/src/cm/common_def.c @@ -388,6 +388,35 @@ Region region, Pool pool, Data *ptr, Size size, uint8_t memType) else return RFAILED; } + + +/******************************************************************* +* +* @brief countSetBits in an integer +* +* @details +* +* Function : countSetBits +* +* Functionality: countSetBits in unsigned integer +* +* @params[in] uint32_t number/Bitmask +* +* @return [out] uint8_t count of Set Bits +* +* ****************************************************************/ +uint8_t countSetBits(uint32_t num) +{ + uint8_t count = 0; + + while(num) + { + count += num & 1; + num >>= 1; + } + return(count); +} + /********************************************************************** End of file **********************************************************************/