Template Function lbcrypto::GetDigitCount

Function Documentation

template<typename T, std::enable_if_t<std::is_integral_v<T> || std::is_same_v<T, int128_t> || std::is_same_v<T, uint128_t>, bool> = true>
inline constexpr uint32_t lbcrypto::GetDigitCount(T x, uint64_t base)

Get the number of base-base digits needed to represent every value below x, i.e. exact ceil(log_base(x)). Integer-only, so it is unaffected by the rounding of std::log and by the loss of precision of converting moduli above 2^53 to double.

Parameters
  • x – the exclusive upper bound on the values to be represented.

  • base – the digit base, at least 2.

Returns

the digit count.