Changeset 2923c7b in mainline
- Timestamp:
- 2013-10-16T16:21:44Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3287e5
- Parents:
- 12d6c98
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/bitops.c
r12d6c98 r2923c7b 33 33 #include <bitops.h> 34 34 35 externint __popcountsi2(int a)35 int __popcountsi2(int a) 36 36 { 37 return __builtin_popcount(a); 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; 38 44 } 39 45
Note:
See TracChangeset
for help on using the changeset viewer.