Changes in uspace/lib/c/generic/bitops.c [2923c7b:a269d05] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/bitops.c
r2923c7b ra269d05 33 33 #include <bitops.h> 34 34 35 int __popcountsi2(int a)35 extern int __popcountsi2(int a) 36 36 { 37 int bits = 0; 38 for (unsigned int i = 0; i < sizeof(a) * 8; i++) { 39 if (((a >> i) & 1) != 0) { 40 bits++; 41 } 42 } 43 return bits; 37 return __builtin_popcount(a); 44 38 } 45 39
Note:
See TracChangeset
for help on using the changeset viewer.