mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-01 14:41:34 +00:00
Add clear_bit and set_bit.
This commit is contained in:
parent
3bea3ec3d8
commit
3062a29b78
|
@ -78,4 +78,14 @@ static inline bool bit_set(const uint64_t val, const int bit_num) {
|
||||||
return !!(val & (1ULL << bit_num));
|
return !!(val & (1ULL << bit_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline void clear_bit(T &val, const int bit_num) {
|
||||||
|
val &= ~((T)1 << bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
inline void set_bit(T &val, const int bit_num) {
|
||||||
|
val |= ((T)1 << bit_num);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // BIT_OPS_H
|
#endif // BIT_OPS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user