Edytuj

Udostępnij za pośrednictwem


BitHelper.HasFlag Method

Definition

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

value
UInt32

The input UInt32 value.

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

value
UInt64

The input UInt64 value.

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.

Applies to