BitOperations Class

Definition

Provides utility methods for intrinsic bit-twiddling operations. The methods use hardware intrinsics when available on the underlying platform; otherwise, they use optimized software fallbacks.

public ref class BitOperations abstract sealed
public static class BitOperations
type BitOperations = class
Public Class BitOperations
Inheritance
BitOperations

Methods

IsPow2(Int32)

Evaluates whether the specified Int32 value is a power of two.

IsPow2(Int64)

Evaluates whether the specified Int64 value is a power of 2.

IsPow2(UInt32)

Evaluates whether the specified UInt32 value is a power of two.

IsPow2(UInt64)

Evaluates whether the specified UInt64 value is a power of two.

LeadingZeroCount(UInt32)

Counts the number of leading zero bits in an unsigned 32-bit integer mask.

LeadingZeroCount(UInt64)

Counts the number of leading zero bits in an unsigned 64-bit integer mask.

Log2(UInt32)

Returns the integer (floor) log of the specified value, base 2.

Log2(UInt64)

Returns the integer (floor) log of the specified value, base 2.

PopCount(UInt32)

Returns the population count (number of bits set) of a mask.

PopCount(UInt64)

Returns the population count (number of bits set) of an unsigned 64-bit integer mask.

RotateLeft(UInt32, Int32)

Rotates the specified value left by the specified number of bits.

RotateLeft(UInt64, Int32)

Rotates the specified value left by the specified number of bits.

RotateRight(UInt32, Int32)

Rotates the specified value right by the specified number of bits.

RotateRight(UInt64, Int32)

Rotates the specified value right by the specified number of bits.

RoundUpToPowerOf2(UInt32)

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

RoundUpToPowerOf2(UInt64)

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

TrailingZeroCount(Int32)

Counts the number of trailing zero bits in an 32-bit integer value mask.

TrailingZeroCount(Int64)

Counts the number of trailing zero bits in a 64-bit integer value mask.

TrailingZeroCount(UInt32)

Counts the number of trailing zero bits in an unsigned 32-bit integer value mask.

TrailingZeroCount(UInt64)

Count the number of trailing zero bits in an unsigned 64-bit integer value mask.

Applies to