GMP Native Interface for .NET
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)

public static mp_bitcnt_t mpn_popcount( mp_ptr s1p, mp_size_t n )
Public Shared Function mpn_popcount ( s1p As mp_ptr, n As mp_size_t ) As mp_bitcnt_t
public: static mp_bitcnt_t mpn_popcount( mp_ptr^ s1p, mp_size_t n )
static member mpn_popcount : s1p : mp_ptr * n : mp_size_t -> mp_bitcnt_t
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_tThe number of set bits in {s1p, n}.

// 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);
' Create multi-precision operand. Dim s1p As New mp_ptr(New UInteger() { &H1, &H1}) ' Assert result of operation. Assert.IsTrue(gmp_lib.mpn_popcount(s1p, s1p.Size) = 2) ' Release unmanaged memory. gmp_lib.free(s1p)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
