Changeset 860a7bb in mainline for uspace/lib/c/generic/bitops.c


Ignore:
Timestamp:
2013-11-12T15:28:42Z (12 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

File:
1 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/** @}
Note: See TracChangeset for help on using the changeset viewer.