Squashed 'external/ircolib/' changes from bb3f168e1..d611a21e5
d611a21e5 imma stop using size_t git-subtree-dir: external/ircolib git-subtree-split: d611a21e50fcfdfb5f34a7f79c4c690c50d85c5f
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace ircolib {
|
||||
using u8 = uint8_t;
|
||||
@@ -12,28 +11,28 @@ using s16 = int16_t;
|
||||
using s32 = int32_t;
|
||||
using s64 = int64_t;
|
||||
|
||||
template <typename T, std::size_t bit>
|
||||
template <typename T, u32 bit>
|
||||
static constexpr bool is_bit_set(const T &val) {
|
||||
return val & (1 << bit);
|
||||
}
|
||||
|
||||
template <typename T, std::size_t bit>
|
||||
template <typename T, u32 bit>
|
||||
static constexpr void set_bit(T &val) {
|
||||
val |= 1 << bit;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline bool is_bit_set(const T &val, const std::size_t &bit) {
|
||||
inline bool is_bit_set(const T &val, const u32 &bit) {
|
||||
return val & (1 << bit);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void set_bit(T &val, const std::size_t &bit) {
|
||||
inline void set_bit(T &val, const u32 &bit) {
|
||||
val |= 1 << bit;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void clear_bit(T &val, const std::size_t &bit) {
|
||||
inline void clear_bit(T &val, const u32 &bit) {
|
||||
val &= ~(1 << bit);
|
||||
}
|
||||
} // namespace ircolib
|
||||
|
||||
Reference in New Issue
Block a user