Changeset d28a03e
 Timestamp:
 May 3, 2018, 10:43:06 AM (5 years ago)
 Branches:
 aaronthesis, armeh, cleanupdtors, deferred_resn, demangler, enum, forallpointerdecay, jacob/cs343translation, jenkinssandbox, master, newast, newastuniqueexpr, newenv, no_list, persistentindexer, pthreademulation, qualifiedEnum, with_gc
 Children:
 7ca8441c
 Parents:
 b68fc85
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/Common/utility.h
rb68fc85 rd28a03e 441 441 442 442 template<typename T> 443 inline constexpr T ilog2(const T & t) { 444 if ( std::is_integral<T>::value ) { 443 inline 444 #if __GNUC__ > 4 445 constexpr 446 #endif 447 T ilog2(const T & t) { 448 if(std::is_integral<T>::value) { 445 449 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); 450 455 return 1; 451 } // i long2456 } // iLog2 452 457 453 458
Note: See TracChangeset
for help on using the changeset viewer.