[ox/std] Add noexcept to bitops functions
This commit is contained in:
parent
10b3757558
commit
9f805f761d
4
deps/ox/src/ox/std/bitops.hpp
vendored
4
deps/ox/src/ox/std/bitops.hpp
vendored
@ -13,13 +13,13 @@
|
|||||||
namespace ox {
|
namespace ox {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
[[nodiscard]] inline constexpr T rotateLeft(T i, std::size_t shift) {
|
[[nodiscard]] inline constexpr T rotateLeft(T i, std::size_t shift) noexcept {
|
||||||
constexpr auto bits = sizeof(i) * 8;
|
constexpr auto bits = sizeof(i) * 8;
|
||||||
return (i << shift) | (i >> (bits - shift));
|
return (i << shift) | (i >> (bits - shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
[[nodiscard]] constexpr T onMask(int bits = sizeof(T) * 8) {
|
[[nodiscard]] constexpr T onMask(int bits = sizeof(T) << 3 /* *8 */) noexcept {
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user