Last active
August 29, 2015 14:10
-
-
Save markpapadakis/fc9a2dae1c115b3bfdb9 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
template<typename T> | |
static inline constexpr T Max(void) | |
{ | |
return std::numeric_limits<T>::is_signed ? (T)((((uint64_t)~0) >> (64 - (sizeof(T) * 8 - 1)))) : ((T)~0) - 1; | |
} | |
template<typename T> | |
static inline constexpr T Min(void) | |
{ | |
return std::numeric_limits<T>::is_signed ? -Max<T>() : 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment