Created
October 15, 2016 17:32
-
-
Save markpapadakis/976f574290e3cbed872129213aef2e2c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#ifdef __OPTIMIZE__ | |
// Unformatelly, we can't tell if it was compiled with -O1, or higher | |
// It's not exposed to the compiled as a macro or feature | |
template<typename T1, typename T2> | |
static constexpr auto fastrange(const T1 word, const T2 p) | |
{ | |
return sizeof(T1) < sizeof(uint64_t) && sizeof(T2) < sizeof(uint64_t) ? fastrange32(word, p) : fastrange64(word, p); | |
} | |
#else | |
#define fastrange(a, b) ((a) % (b)) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment