Bitmask
Struct in Zigurous.Architecture
Declaration
[Serializable]
public struct Bitmask : IEquatable<Bitmask>, IEquatable<int>
Description
A bitmask representation that can be used for bitwise operations. A bitmask is a set of bits that can be set or cleared.
Constructors
Bitmask | Creates a new Bitmask from the given 32-bit integer. |
Methods
HasFlag | Checks if the bitmask contains the flag. (mask & flag) == flag |
HasAnyFlag | Checks if the bitmask contains any of the flags. (mask & flags) != 0 |
HasOnlyFlags | Checks if the bitmask contains only the given flags and no other flags. ((mask ^ flags) & flags) == 0 |
Has | Checks if the nth bit of the bitmask is set. |
Get | Returns the nth bit of the bitmask. |
Set | Sets the nth bit of the bitmask to 1. |
Clear | Sets the nth bit of the bitmask to 0. |
Toggle | Toggles the nth bit of the bitmask. |
Change | Sets the nth bit of the bitmask to x. |
Equals | Determines if the bitmask is equal to another bitmask. |
GetHashCode | Returns the hash code of the bitmask. |
ToString | Converts the bitmask to a string. |
Operators
Equality | Determines if two bitmasks are equal. |
Inequality | Determines if two bitmasks are not equal. |
BitwiseAnd | Performs a bitwise AND operation on two bitmasks. |
BitwiseOr | Performs a bitwise OR operation on two bitmasks. |
ExclusiveOr | Performs a bitwise XOR operation on two bitmasks. |
OnesComplement | Performs a bitwise ones' complement operation on a bitmask. |
LeftShift | Performs a binary left shift operation on two bitmasks. |
RightShift | Performs a binary right shift operation on two bitmasks. |
Implicit | Implicitly converts a bitmask to an integer. |