Last active
August 15, 2017 20:47
-
-
Save magurosan/c27cd2ce337eed9e26a838c32ef4cd5f to your computer and use it in GitHub Desktop.
static tzcnt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct static_tzcnt { | |
constexpr size_t operator ()(size_t x) const { | |
return (x == 0) ? (sizeof(size_t) * 8) | |
: ((x & 1)? 0 : (1 + operator()(x >> 1))); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment