Changeset ee06db5c


Ignore:
Timestamp:
Jun 9, 2020, 3:45:39 PM (18 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
280ec46, 97392b69
Parents:
b54118a
Message:

change algorithm for computing all0s in the bit-manipulation routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bitmanip.hfa

    rb54118a ree06db5c  
    1111// Created On       : Sat Mar 14 18:12:27 2020
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Sun Apr 19 22:29:58 2020
    14 // Update Count     : 121
     13// Last Modified On : Tue Jun  9 15:14:04 2020
     14// Update Count     : 123
    1515//
    1616
     
    4848
    4949        // Count all 0 bits.
    50         unsigned int all0s( unsigned char n ) { return __bitsizeof(n) - __builtin_popcount( n ); }
    51         unsigned int all0s( unsigned short int n ) { return __bitsizeof(n) - __builtin_popcount( n ); }
    52         unsigned int all0s( unsigned int n ) { return __bitsizeof(n) - __builtin_popcount( n ); }
    53         unsigned int all0s( unsigned long int n ) { return __bitsizeof(n) - __builtin_popcountl( n ); }
    54         unsigned int all0s( unsigned long long int n ) { return __bitsizeof(n) - __builtin_popcountll( n ); }
     50        unsigned int all0s( unsigned char n ) { return __builtin_popcount( (typeof(n))~n ); }
     51        unsigned int all0s( unsigned short int n ) { return __builtin_popcount( (typeof(n))~n ); }
     52        unsigned int all0s( unsigned int n ) { return __builtin_popcount( ~n ); }
     53        unsigned int all0s( unsigned long int n ) { return __builtin_popcountl( ~n ); }
     54        unsigned int all0s( unsigned long long int n ) { return __builtin_popcountll( ~n ); }
    5555
    5656        // Find least significiant zero bit. (ffs)
Note: See TracChangeset for help on using the changeset viewer.