VirtualBox

Ignore:
Timestamp:
Aug 1, 2016 4:50:21 PM (8 years ago)
Author:
vboxsync
Message:

dt_popc: Use ARCH_BITS and UINTxx_C() instead of _IPL32/_LP64 and UL/ULL.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_subr.c

    r62829 r62836  
    854854dt_popc(ulong_t x)
    855855{
     856#ifdef VBOX
     857# if ARCH_BITS == 32
     858    x = x - ((x >> 1) & UINT32_C(0x55555555));
     859    x = (x & UINT32_C(0x33333333)) + ((x >> 2) & UINT32_C(0x33333333));
     860    x = (x + (x >> 4)) & UINT32_C(0x0F0F0F0F);
     861    x = x + (x >> 8);
     862    x = x + (x >> 16);
     863    return (x & 0x3F);
     864# elif ARCH_BITS == 64
     865    x = x - ((x >> 1) & UINT64_C(0x5555555555555555));
     866    x = (x & UINT64_C(0x3333333333333333)) + ((x >> 2) & UINT64_C(0x3333333333333333));
     867    x = (x + (x >> 4)) & UINT64_C(0x0F0F0F0F0F0F0F0F);
     868    x = x + (x >> 8);
     869    x = x + (x >> 16);
     870    x = x + (x >> 32);
     871    return (x & 0x7F);
     872# else
     873#  error "ARCH_BITS"
     874# endif
     875#else  /* !VBOX */
    856876#ifdef _ILP32
    857877        x = x - ((x >> 1) & 0x55555555UL);
     
    871891        return (x & 0x7F);
    872892#endif
     893#endif /* !VBOX */
    873894}
    874895
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette