本文整理汇总了C++中BigUInt::bit_count方法的典型用法代码示例。如果您正苦于以下问题:C++ BigUInt::bit_count方法的具体用法?C++ BigUInt::bit_count怎么用?C++ BigUInt::bit_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BigUInt
的用法示例。
在下文中一共展示了BigUInt::bit_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exponentiate_uint_mod
void exponentiate_uint_mod(const BigUInt &operand, const BigUInt &exponent,
const BigUInt &modulus, BigUInt &destination, const MemoryPoolHandle &pool)
{
if (operand.significant_bit_count() > modulus.significant_bit_count())
{
throw invalid_argument("operand is not reduced");
}
if (operand.is_zero() && exponent == 0)
{
throw invalid_argument("undefined operation");
}
if (!pool)
{
throw invalid_argument("pool is uninitialized");
}
if (operand.is_zero())
{
destination.set_zero();
return;
}
if (destination.bit_count() != modulus.significant_bit_count())
{
destination.resize(modulus.significant_bit_count());
}
ConstPointer operand_ptr = duplicate_uint_if_needed(operand, modulus.uint64_count(), false, pool);
util::exponentiate_uint_mod(operand_ptr.get(), exponent.data(), exponent.uint64_count(), Modulus(modulus.data(), modulus.uint64_count(), pool), destination.data(), pool);
}
示例2: result
BigUInt BigUInt::operator -(const BigUInt& operand2) const
{
int result_bits = max(bit_count_, operand2.bit_count());
BigUInt result(result_bits);
sub_uint_uint(value_, uint64_count(), operand2.pointer(), operand2.uint64_count(), false, result.uint64_count(), result.pointer());
filter_highbits_uint(result.pointer(), result.uint64_count(), result_bits);
return result;
}
示例3: resize
BigUInt::BigUInt(const BigUInt& copy) : value_(nullptr), bit_count_(0), is_alias_(false)
{
resize(copy.bit_count());
operator =(copy);
}