Merge commit 'f070e484cdac8a6d6a2e6f039aa69555e0739133'
This commit is contained in:
Vendored
+5
-6
@@ -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