Edit

Share via


BitHelper.ExtractRange Method

Definition

Overloads

ExtractRange(UInt32, Byte, Byte)

Extracts a bit field range from a given value.

ExtractRange(UInt64, Byte, Byte)

Extracts a bit field range from a given value.

ExtractRange(UInt32, Byte, Byte)

Extracts a bit field range from a given value.

public static uint ExtractRange (uint value, byte start, byte length);
static member ExtractRange : uint32 * byte * byte -> uint32
Public Shared Function ExtractRange (value As UInteger, start As Byte, length As Byte) As UInteger

Parameters

value
UInt32

The input UInt32 value.

start
Byte

The initial index of the range to extract (in [0, 31] range).

length
Byte

The length of the range to extract (depends on start).

Returns

The value of the extracted range within value.

Remarks

This method doesn't validate start and length. If either parameter is not valid, the result will just be inconsistent. The method should not be used to set all the bits at once, and it is not guaranteed to work in that case, which would just be equivalent to assigning the UInt32 value. Additionally, no conditional branches are used to retrieve the range.

Applies to

ExtractRange(UInt64, Byte, Byte)

Extracts a bit field range from a given value.

public static ulong ExtractRange (ulong value, byte start, byte length);
static member ExtractRange : uint64 * byte * byte -> uint64
Public Shared Function ExtractRange (value As ULong, start As Byte, length As Byte) As ULong

Parameters

value
UInt64

The input UInt64 value.

start
Byte

The initial index of the range to extract (in [0, 63] range).

length
Byte

The length of the range to extract (depends on start).

Returns

The value of the extracted range within value.

Remarks

This method doesn't validate start and length. If either parameter is not valid, the result will just be inconsistent. The method should not be used to set all the bits at once, and it is not guaranteed to work in that case, which would just be equivalent to assigning the UInt64 value. Additionally, no conditional branches are used to retrieve the range.

Applies to