Changes in src/Common/utility.h [f14d956:9dc31c10]
- File:
-
- 1 edited
-
src/Common/utility.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rf14d956 r9dc31c10 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 20 22:35:33201813 // Update Count : 3 812 // Last Modified On : Thu Apr 19 16:21:44 2018 13 // Update Count : 37 14 14 // 15 15 … … 437 437 438 438 // ----------------------------------------------------------------------------- 439 // O(1) polymorphic integer ilog2, using clz, which returns the number of leading 0-bits, starting at the most439 // O(1) polymorphic integer log2, using clz, which returns the number of leading 0-bits, starting at the most 440 440 // significant bit (single instruction on x86) 441 441 442 442 template<typename T> 443 inline constexpr T ilog2(const T & t) {443 inline constexpr T log2(const T & t) { 444 444 if ( std::is_integral<T>::value ) { 445 445 const constexpr int r = sizeof(t) * __CHAR_BIT__ - 1; … … 449 449 } // if 450 450 return -1; 451 } // ilong2451 } 452 452 453 453
Note:
See TracChangeset
for help on using the changeset viewer.