Changeset 7ca8441c


Ignore:
Timestamp:
May 3, 2018, 12:16:47 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
af39199d
Parents:
fb16d5c (diff), d28a03e (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.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rfb16d5c r7ca8441c  
    441441
    442442template<typename T>
    443 inline constexpr T ilog2(const T & t) {
    444         if ( std::is_integral<T>::value ) {
     443inline
     444#if __GNUC__ > 4
     445constexpr
     446#endif
     447T ilog2(const T & t) {
     448        if(std::is_integral<T>::value) {
    445449                const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1;
    446                 if ( sizeof(T) == sizeof(unsigned int ) ) return r - __builtin_clz( t );
    447                 if ( sizeof(T) == sizeof(unsigned long) ) return r - __builtin_clzl( t );
    448                 if ( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
    449         } // if
     450                if( sizeof(T) == sizeof(unsigned       int) ) return r - __builtin_clz  ( t );
     451                if( sizeof(T) == sizeof(unsigned      long) ) return r - __builtin_clzl ( t );
     452                if( sizeof(T) == sizeof(unsigned long long) ) return r - __builtin_clzll( t );
     453        }
     454        assert(false);
    450455        return -1;
    451 } // ilong2
     456} // iLog2
    452457
    453458
Note: See TracChangeset for help on using the changeset viewer.