Changeset 860a7bb in mainline


Ignore:
Timestamp:
2013-11-12T15:28:42Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d1be7b
Parents:
cb2739a
Message:

Implement popcountdi2

Location:
uspace/lib/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/bitops.c

    rcb2739a r860a7bb  
    4444}
    4545
     46int __popcountdi2(long a)
     47{
     48        int bits = 0;
     49        for (unsigned int i = 0; i < sizeof(a) * 8; i++)         {
     50                if (((a >> i) & 1) != 0) {
     51                        bits++;
     52                }
     53        }
     54        return bits;                                                                   
     55}
    4656
    4757/** @}
  • uspace/lib/c/include/bitops.h

    rcb2739a r860a7bb  
    108108
    109109extern int __popcountsi2(int);
     110extern int __popcountdi2(long);
    110111
    111112#endif
Note: See TracChangeset for help on using the changeset viewer.