[ox/std] Add MaxValue constexpr template

This commit is contained in:
Gary Talent 2018-07-07 14:36:27 -05:00
parent 86b36b48a3
commit 87b580a72a
2 changed files with 8 additions and 1 deletions

View File

@ -17,7 +17,7 @@ inline constexpr T rotateLeft(T i, int shift) {
} }
template<typename T> template<typename T>
constexpr T onMask(int bits) { constexpr T onMask(int bits = sizeof(T)) {
T out = 0; T out = 0;
for (auto i = 0; i < bits; i++) { for (auto i = 0; i < bits; i++) {
out |= static_cast<T>(1) << i; out |= static_cast<T>(1) << i;

View File

@ -51,6 +51,13 @@ typedef uint32_t uintptr_t;
#endif #endif
namespace ox {
template<typename T>
constexpr auto MaxValue = onMask<T>();
}
namespace std { namespace std {