Class Bitmask
- Namespace
- ArcanaDevelopment.adTempus.Shared
- Assembly
- ArcanaDevelopment.adTempus.Shared.dll
public static class Bitmask
- Inheritance
-
objectBitmask
Methods
CreateBitmask(params int[])
Gets a bitmask with a specified bit set.
public static int CreateBitmask(params int[] bits)
Parameters
| Name | Type | Description |
|---|---|---|
bits |
int[] |
Returns
- int
HasBit(int, int)
Tests whether a specified bit is set in a bitmask.
public static bool HasBit(int val, int bit)
Parameters
| Name | Type | Description |
|---|---|---|
val |
int | The value to test. |
bit |
int | The bit (0 - 31) to test. |
Returns
- bool
HasFlags(int, int)
Tests whether the specified value is included in a bitmask.
public static bool HasFlags(int val, int mask)
Parameters
| Name | Type | Description |
|---|---|---|
val |
int | |
mask |
int |
Returns
- bool
Remarks
This tests for a value, not a bit, by performing a bitwise AND between val and mask.
SetBit(int, int, bool)
Sets a bit in a bitmask.
public static int SetBit(int val, int bit, bool setting)
Parameters
| Name | Type | Description |
|---|---|---|
val |
int | The bitmask value to update. |
bit |
int | The bit (0 - 31) to set |
setting |
bool |
Returns
- int
SetFlags(int, int, bool)
Sets or clears a mask in a bitmask.
public static int SetFlags(int val, int mask, bool setting)
Parameters
| Name | Type | Description |
|---|---|---|
val |
int | |
mask |
int | |
setting |
bool |
Returns
- int
Remarks
This sets or clears a value, not a bit, by performing a bitwise OR between val and mask.