Читати англійською Редагувати

Поділитися через


BitOperations.PopCount Method

Definition

Overloads

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)

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

PopCount(UIntPtr)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

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.

[System.CLSCompliant(false)]
public static int PopCount (UIntPtr value);

Parameters

value
UIntPtr

The value.

Returns

The population count.

Attributes

Applies to

.NET 9 та інші версії
Продукт Версії
.NET 7, 8, 9

PopCount(UInt32)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

Important

This API is not CLS-compliant.

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

[System.CLSCompliant(false)]
public static int PopCount (uint value);

Parameters

value
UInt32

The mask.

Returns

The population count of a mask.

Attributes

Remarks

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

Applies to

.NET 9 та інші версії
Продукт Версії
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9

PopCount(UInt64)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

Important

This API is not CLS-compliant.

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

[System.CLSCompliant(false)]
public static int PopCount (ulong value);

Parameters

value
UInt64

The mask.

Returns

The population count of the mask.

Attributes

Remarks

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

Applies to

.NET 9 та інші версії
Продукт Версії
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9