【发布时间】:2014-11-19 05:24:20
【问题描述】:
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html 说
——内置函数:int __builtin_popcount (unsigned int x) 返回 x 中 1 的位数。
所以也一样,我在c#中尝试了以下代码
long l8 = 9;
int iCont = Convert.ToString(l8, 2).Split('0').ToList().FindAll(x=>x=="1").Count;
我想在堆栈溢出中仔细检查这个问题,如果这是我所做的错误,或者是否有任何内置函数做同样的事情。
【问题讨论】: