Click or drag to resize
gmp_libmpn_popcount Method
Count the number of set bits in {s1p, n}.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static mp_bitcnt_t mpn_popcount(
	mp_ptr s1p,
	mp_size_t n
)

Parameters

s1p
Type: Math.Gmp.Nativemp_ptr
The operand integer.
n
Type: Math.Gmp.Nativemp_size_t
The number of limbs of s1p.

Return Value

Type: mp_bitcnt_t
The number of set bits in {s1p, n}.
Examples
// Create multi-precision operand.
mp_ptr s1p = new mp_ptr(new uint[] { 0x0000001, 0x00000001 });

// Assert result of operation.
Assert.IsTrue(gmp_lib.mpn_popcount(s1p, s1p.Size) == 2);

// Release unmanaged memory.
gmp_lib.free(s1p);
See Also