This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.

34 lines
521 B
C++
Raw Normal View History

#pragma once
namespace big::misc
{
inline void clear_bit(int* address, int pos)
{
*address &= ~(1 << pos);
}
inline void clear_bits(int* address, int bits)
{
*address &= ~(bits);
}
inline bool has_bit_set(int* address, int pos)
{
return *address & 1 << pos;
}
inline bool has_bits_set(int* address, int bits)
{
return (*address & bits) == bits;
}
inline void set_bit(int* address, int pos)
{
*address |= 1 << pos;
}
inline void set_bits(int* address, int bits)
{
*address |= bits;
}
}