Changeset 0c96e6cb in mainline for uspace/lib/c/generic/bitops.c
- Timestamp:
- 2013-10-18T11:00:23Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b5851913
- Parents:
- 39bcc99 (diff), 9f9450bb (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/bitops.c
r39bcc99 r0c96e6cb 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.