18#if(BOTAN_MP_WORD_BITS == 64)
19 const word conversion_radix = 10000000000000000000U;
20 const word radix_digits = 19;
22 const word conversion_radix = 1000000000U;
23 const word radix_digits = 9;
27 const size_t digit_estimate =
static_cast<size_t>(1 + (this->
bits() / 3.32));
30 const size_t digit_blocks = (digit_estimate + radix_digits - 1) / radix_digits;
36 std::vector<word> digit_groups(digit_blocks);
38 for(
size_t i = 0; i != digit_blocks; ++i) {
41 digit_groups[i] = remainder;
47 std::vector<uint8_t> digits(digit_blocks * radix_digits);
49 for(
size_t i = 0; i != digit_blocks; ++i) {
50 word remainder = digit_groups[i];
51 for(
size_t j = 0; j != radix_digits; ++j) {
53 const word digit = remainder % 10;
55 digits[radix_digits * i + j] =
static_cast<uint8_t
>(digit);
60 while(!digits.empty() && digits.back() == 0) {
68 s.reserve(1 + digits.size());
75 for(
auto i = digits.rbegin(); i != digits.rend(); ++i) {
76 s.push_back(*i +
'0');