[ox/std] Make rotateLeft a template so it can operate on any size int
This commit is contained in:
parent
4e3c98bcb5
commit
f64bcce564
6
deps/ox/src/ox/std/bitops.hpp
vendored
6
deps/ox/src/ox/std/bitops.hpp
vendored
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
inline uint64_t rotateLeft(uint64_t i, int shift) {
|
template<typename T>
|
||||||
return (i << shift) | (i >> (64 - shift));
|
inline constexpr T rotateLeft(T i, int shift) {
|
||||||
|
constexpr auto bits = sizeof(i) * 8;
|
||||||
|
return (i << shift) | (i >> (bits - shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user