Class LongBitExtensions
- Namespace
- FishMMO.Shared
- Assembly
- FishMMO-SharedUtility.dll
Extension methods for high-performance bitwise flag manipulation on 64-bit integers (long). Supports both raw bit indices and generic Enum-based bit positions (0-63).
public static class LongBitExtensions
- Inheritance
-
LongBitExtensions
- Inherited Members
Methods
DisableBit(ref long, int)
Sets the specified bit to 0 (off) using a bitwise NOT and AND operation.
public static void DisableBit(this ref long flag, int bitPosition)
Parameters
DisableBit<T>(ref long, T)
Sets the specified generic bit position to 0 (off).
public static void DisableBit<T>(this ref long flag, T bitPosition) where T : unmanaged, Enum
Parameters
flaglongbitPositionT
Type Parameters
T
EnableBit(ref long, int)
Sets the specified bit to 1 (on) using a bitwise OR operation.
public static void EnableBit(this ref long flag, int bitPosition)
Parameters
EnableBit<T>(ref long, T)
Sets the specified generic bit position to 1 (on).
public static void EnableBit<T>(this ref long flag, T bitPosition) where T : unmanaged, Enum
Parameters
flaglongbitPositionT
Type Parameters
T
IsFlagged(long, int)
Checks if the specified bit position is set (1) in the long value.
public static bool IsFlagged(this long flag, int bitPosition)
Parameters
Returns
- bool
True if the bit is set; otherwise, false.
IsFlagged<T>(long, T)
Checks if the specified generic bit position is set. Useful for large flag sets defined in Enums.
public static bool IsFlagged<T>(this long flag, T bitPosition) where T : unmanaged, Enum
Parameters
flaglongbitPositionT
Returns
Type Parameters
TAn enum type backed by long.
ToggleBit(ref long, int)
Reverses the state of the specified bit (1 becomes 0, 0 becomes 1).
public static void ToggleBit(this ref long flag, int bitPosition)
Parameters
ToggleBit<T>(ref long, T)
Reverses the state of the specified generic bit position (1 becomes 0, 0 becomes 1).
public static void ToggleBit<T>(this ref long flag, T bitPosition) where T : unmanaged, Enum
Parameters
flaglongbitPositionT
Type Parameters
T