BitOperations.PopCount Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
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
The population count.
- Attributes
Applies to
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.
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
The population count of a mask.
- Attributes
Remarks
This method is similar in behavior to the x86 instruction POPCNT.
Applies to
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.
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
The population count of the mask.
- Attributes
Remarks
This method is similar in behavior to the x86 instruction POPCNT.