Method Gmp.mpz()->popcount() Method popcount int popcount() Description For values >= 0, returns the population count (the number of set bits). For negative values (who have an infinite number of leading ones in a binary representation), -1 is returned.