BitOperations.PopCount Method

Definition

Overloads

PopCount(UInt64)

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

PopCount(UIntPtr)

Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT.

PopCount(UInt32)

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

PopCount(UInt64)

Important

This API is not CLS-compliant.

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

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

Parameters

value
UInt64

The mask.

Returns

Int32

The population count of the mask.

Attributes

Remarks

This method is similar in behavior to the x86 instruction POPCNT.

Applies to

PopCount(UIntPtr)

Important

This API is not CLS-compliant.

Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT.

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

Parameters

value
UIntPtr

unativeint

The value.

Returns

Int32

The population count.

Attributes

Applies to

PopCount(UInt32)

Important

This API is not CLS-compliant.

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

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

Parameters

value
UInt32

The mask.

Returns

Int32

The population count of a mask.

Attributes

Remarks

This method is similar in behavior to the x86 instruction POPCNT.

Applies to