[ox/std] Add MaxValue constexpr template
This commit is contained in:
parent
86b36b48a3
commit
87b580a72a
2
deps/ox/src/ox/std/bitops.hpp
vendored
2
deps/ox/src/ox/std/bitops.hpp
vendored
@ -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;
|
||||||
|
7
deps/ox/src/ox/std/types.hpp
vendored
7
deps/ox/src/ox/std/types.hpp
vendored
@ -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 {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user