BitHelper.HasFlag Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
HasFlag(UInt32, Int32) |
Checks whether or not a given bit is set. |
HasFlag(UInt64, Int32) |
Checks whether or not a given bit is set. |
HasFlag(UInt32, Int32)
Checks whether or not a given bit is set.
public static bool HasFlag (uint value, int n);
static member HasFlag : uint32 * int -> bool
Public Shared Function HasFlag (value As UInteger, n As Integer) As Boolean
Parameters
- n
- Int32
The position of the bit to check (in [0, 31] range).
Returns
Whether or not the n-th bit is set.
Remarks
This method doesn't validate n
against the valid range. If the parameter is not valid, the result will just be inconsistent. Additionally, no conditional branches are used to retrieve the flag.
Applies to
HasFlag(UInt64, Int32)
Checks whether or not a given bit is set.
public static bool HasFlag (ulong value, int n);
static member HasFlag : uint64 * int -> bool
Public Shared Function HasFlag (value As ULong, n As Integer) As Boolean
Parameters
- n
- Int32
The position of the bit to check (in [0, 63] range).
Returns
Whether or not the n-th bit is set.
Remarks
This method doesn't validate n
against the valid range. If the parameter is not valid, the result will just be inconsistent. Additionally, no conditional branches are used to retrieve the flag.