[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 {
|
||||
|
||||
inline uint64_t rotateLeft(uint64_t i, int shift) {
|
||||
return (i << shift) | (i >> (64 - shift));
|
||||
template<typename T>
|
||||
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