BitOperations.RoundUpToPowerOf2 Method

Definition

Overloads

RoundUpToPowerOf2(UInt32)

Rounds the specified UInt32 value up to a power of two.

RoundUpToPowerOf2(UInt64)

Rounds the specified UInt64 value up to a power of two.

RoundUpToPowerOf2(UIntPtr)

Rounds the given integral value up to a power of 2.

RoundUpToPowerOf2(UInt32)

Important

This API is not CLS-compliant.

Rounds the specified UInt32 value up to a power of two.

public:
 static System::UInt32 RoundUpToPowerOf2(System::UInt32 value);
[System.CLSCompliant(false)]
public static uint RoundUpToPowerOf2 (uint value);
[<System.CLSCompliant(false)>]
static member RoundUpToPowerOf2 : uint32 -> uint32
Public Shared Function RoundUpToPowerOf2 (value As UInteger) As UInteger

Parameters

value
UInt32

The value to round up to a power of two.

Returns

UInt32

The smallest power of two that's greater than or equal to value. If value is 0 or the result overflows, returns 0.

Attributes

Applies to

RoundUpToPowerOf2(UInt64)

Important

This API is not CLS-compliant.

Rounds the specified UInt64 value up to a power of two.

public:
 static System::UInt64 RoundUpToPowerOf2(System::UInt64 value);
[System.CLSCompliant(false)]
public static ulong RoundUpToPowerOf2 (ulong value);
[<System.CLSCompliant(false)>]
static member RoundUpToPowerOf2 : uint64 -> uint64
Public Shared Function RoundUpToPowerOf2 (value As ULong) As ULong

Parameters

value
UInt64

The value to round up to a power of two.

Returns

UInt64

The smallest power of two that's greater than or equal to value.

If value is 0 or the result overflows, returns 0.

Attributes

Applies to

RoundUpToPowerOf2(UIntPtr)

Important

This API is not CLS-compliant.

Rounds the given integral value up to a power of 2.

public:
 static UIntPtr RoundUpToPowerOf2(UIntPtr value);
[System.CLSCompliant(false)]
public static UIntPtr RoundUpToPowerOf2 (UIntPtr value);
[<System.CLSCompliant(false)>]
static member RoundUpToPowerOf2 : unativeint -> unativeint
Public Shared Function RoundUpToPowerOf2 (value As UIntPtr) As UIntPtr

Parameters

value
UIntPtr

unativeint

The value.

Returns

UIntPtr

unativeint

The smallest power of 2 which is greater than or equal to value. If value is 0 or the result overflows, returns 0.

Attributes

Applies to