Share via


BitOperations.PopCount 方法

定義

多載

PopCount(UIntPtr)

傳回遮罩的母體擴展計數 (位元集數)。 類似於 x86 指令 POPCNT 的行為。

PopCount(UInt32)

傳回遮罩的母體擴展計數 (位元集數)。

PopCount(UInt64)

傳回不帶正負號 64 位元整數遮罩的母體擴展計數 (位元集數)。

PopCount(UIntPtr)

來源:
BitOperations.cs
來源:
BitOperations.cs
來源:
BitOperations.cs

重要

此 API 不符合 CLS 規範。

傳回遮罩的母體擴展計數 (位元集數)。 類似於 x86 指令 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

參數

value
UIntPtr

unativeint

數值。

傳回

母體計數。

屬性

適用於

PopCount(UInt32)

來源:
BitOperations.cs
來源:
BitOperations.cs
來源:
BitOperations.cs

重要

此 API 不符合 CLS 規範。

傳回遮罩的母體擴展計數 (位元集數)。

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

參數

value
UInt32

遮罩。

傳回

遮罩的母體擴展計數。

屬性

備註

這個方法的行為類似於 x86 指令 POPCNT

適用於

PopCount(UInt64)

來源:
BitOperations.cs
來源:
BitOperations.cs
來源:
BitOperations.cs

重要

此 API 不符合 CLS 規範。

傳回不帶正負號 64 位元整數遮罩的母體擴展計數 (位元集數)。

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

參數

value
UInt64

遮罩。

傳回

遮罩的母體擴展計數。

屬性

備註

這個方法的行為類似於 x86 指令 POPCNT

適用於