[ox/std] Make rotateLeft a template so it can operate on any size int

This commit is contained in:
Gary Talent 2018-04-30 21:05:21 -05:00
parent 4e3c98bcb5
commit f64bcce564

View File

@ -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));
} }
} }