The https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html says
— Built-in Function: int __builtin_popcount (unsigned int x) Returns the number of 1-bits in x.
So todo the same, I tried the following code in c#
long l8 = 9;
int iCont = Convert.ToString(l8, 2).Split('0').ToList().FindAll(x=>x=="1").Count;
I wanted to double check with this question in stack overflow that, if this is wrong what I did or is there any built in functions do the same.