used ``dup_pack_mul`` only with gmpy
used ``bitcount`` instead of ``bit_length`` for compatibility with Python2.6