首页 > 技术文章 > __builtin_popcount
lyp-Bird 2019-01-30 09:53 原文
__builtin_popcount(n)
计算32位二进制数中有多少个1
例:
n=63;//(111111)2
x=__builtin_popcount(n);
x=6;