فهرست منبع

Fix clang-format indents

Sam Jaffe 4 سال پیش
والد
کامیت
dec69ac344
7فایلهای تغییر یافته به همراه264 افزوده شده و 264 حذف شده
  1. 1 1
      .clang-format
  2. 81 81
      include/math/bigdecimal.h
  3. 61 61
      include/math/biginteger.h
  4. 10 10
      include/math/bignum_helper.h
  5. 1 1
      include/math/number_format.h
  6. 107 107
      src/bignum_helper.cpp
  7. 3 3
      test/bignumber_test_printers.h

+ 1 - 1
.clang-format

@@ -75,7 +75,7 @@ KeepEmptyLinesAtTheStartOfBlocks: true
 MacroBlockBegin: ''
 MacroBlockEnd:   ''
 MaxEmptyLinesToKeep: 1
-NamespaceIndentation: All
+NamespaceIndentation: None
 ObjCBlockIndentWidth: 2
 ObjCSpaceAfterProperty: false
 ObjCSpaceBeforeProtocolList: true

+ 81 - 81
include/math/bigdecimal.h

@@ -13,85 +13,85 @@
 #include "number_format.h"
 
 namespace math {
-  class bigdecimal {
-  private:
-    template <typename Int>
-    using is_signed_t =
-        typename std::enable_if<std::numeric_limits<Int>::is_integer &&
-                                    std::numeric_limits<Int>::is_signed,
-                                void *>::type;
-    template <typename Int>
-    using is_unsigned_t =
-        typename std::enable_if<std::numeric_limits<Int>::is_integer &&
-                                    !std::numeric_limits<Int>::is_signed,
-                                void *>::type;
-
-  public:
-    using data_type = std::vector<int32_t>;
-    static bigdecimal const ZERO, ONE, NEGATIVE_ONE;
-    static constexpr int32_t const MAX_SEG{999999999};
-    static constexpr int32_t const OVER_SEG{1000000000};
-    static constexpr int32_t const SEG_DIGITS{9};
-
-  public:
-    bigdecimal();
-
-    template <typename Value>
-    bigdecimal(Value && value, int32_t scale) : bigdecimal(value) {
-      rescale(scale);
-    }
-
-    template <typename Int>
-    bigdecimal(Int value, is_signed_t<Int> = nullptr)
-        : bigdecimal(value < 0,
-                     static_cast<uint64_t>(value < 0 ? -value : value)) {}
-
-    template <typename Int>
-    bigdecimal(Int value, is_unsigned_t<Int> = nullptr)
-        : bigdecimal(false, static_cast<uint64_t>(value)) {}
-
-    bigdecimal(long double);
-    bigdecimal(char const *);
-
-    int32_t scale() const { return scale_; }
-    void rescale(int32_t);
-    void set_value(bigdecimal const &);
-
-    bigdecimal operator-() const;
-
-    friend bigdecimal operator+(bigdecimal, bigdecimal const &);
-    friend bigdecimal operator-(bigdecimal, bigdecimal const &);
-    friend bigdecimal operator*(bigdecimal, bigdecimal const &);
-    friend bigdecimal operator/(bigdecimal, bigdecimal const &);
-    friend bigdecimal & operator+=(bigdecimal &, bigdecimal const &);
-    friend bigdecimal & operator-=(bigdecimal &, bigdecimal const &);
-    friend bigdecimal & operator*=(bigdecimal &, bigdecimal const &);
-    friend bigdecimal & operator/=(bigdecimal &, bigdecimal const &);
-
-    friend bool operator==(bigdecimal const &, bigdecimal const &);
-    friend bool operator!=(bigdecimal const &, bigdecimal const &);
-    friend bool operator<=(bigdecimal const &, bigdecimal const &);
-    friend bool operator<(bigdecimal const &, bigdecimal const &);
-    friend bool operator>=(bigdecimal const &, bigdecimal const &);
-    friend bool operator>(bigdecimal const &, bigdecimal const &);
-
-    std::string to_string(number_format fmt = {}) const;
-
-  private:
-    bigdecimal(bool, uint64_t);
-    void set_scale(int32_t);
-    void subtract_impl(bigdecimal const &, bool);
-
-    friend void swap(bigdecimal & rhs, bigdecimal & lhs) {
-      using std::swap;
-      swap(rhs.is_negative, lhs.is_negative);
-      swap(rhs.scale_, lhs.scale_);
-      swap(rhs.steps_, lhs.steps_);
-      swap(rhs.data, lhs.data);
-    }
-
-    bool is_negative;
-    int32_t scale_{0}, steps_{0};
-    data_type data{};
-  };
+class bigdecimal {
+private:
+  template <typename Int>
+  using is_signed_t =
+      typename std::enable_if<std::numeric_limits<Int>::is_integer &&
+                                  std::numeric_limits<Int>::is_signed,
+                              void *>::type;
+  template <typename Int>
+  using is_unsigned_t =
+      typename std::enable_if<std::numeric_limits<Int>::is_integer &&
+                                  !std::numeric_limits<Int>::is_signed,
+                              void *>::type;
+
+public:
+  using data_type = std::vector<int32_t>;
+  static bigdecimal const ZERO, ONE, NEGATIVE_ONE;
+  static constexpr int32_t const MAX_SEG{999999999};
+  static constexpr int32_t const OVER_SEG{1000000000};
+  static constexpr int32_t const SEG_DIGITS{9};
+
+public:
+  bigdecimal();
+
+  template <typename Value>
+  bigdecimal(Value && value, int32_t scale) : bigdecimal(value) {
+    rescale(scale);
+  }
+
+  template <typename Int>
+  bigdecimal(Int value, is_signed_t<Int> = nullptr)
+      : bigdecimal(value < 0,
+                   static_cast<uint64_t>(value < 0 ? -value : value)) {}
+
+  template <typename Int>
+  bigdecimal(Int value, is_unsigned_t<Int> = nullptr)
+      : bigdecimal(false, static_cast<uint64_t>(value)) {}
+
+  bigdecimal(long double);
+  bigdecimal(char const *);
+
+  int32_t scale() const { return scale_; }
+  void rescale(int32_t);
+  void set_value(bigdecimal const &);
+
+  bigdecimal operator-() const;
+
+  friend bigdecimal operator+(bigdecimal, bigdecimal const &);
+  friend bigdecimal operator-(bigdecimal, bigdecimal const &);
+  friend bigdecimal operator*(bigdecimal, bigdecimal const &);
+  friend bigdecimal operator/(bigdecimal, bigdecimal const &);
+  friend bigdecimal & operator+=(bigdecimal &, bigdecimal const &);
+  friend bigdecimal & operator-=(bigdecimal &, bigdecimal const &);
+  friend bigdecimal & operator*=(bigdecimal &, bigdecimal const &);
+  friend bigdecimal & operator/=(bigdecimal &, bigdecimal const &);
+
+  friend bool operator==(bigdecimal const &, bigdecimal const &);
+  friend bool operator!=(bigdecimal const &, bigdecimal const &);
+  friend bool operator<=(bigdecimal const &, bigdecimal const &);
+  friend bool operator<(bigdecimal const &, bigdecimal const &);
+  friend bool operator>=(bigdecimal const &, bigdecimal const &);
+  friend bool operator>(bigdecimal const &, bigdecimal const &);
+
+  std::string to_string(number_format fmt = {}) const;
+
+private:
+  bigdecimal(bool, uint64_t);
+  void set_scale(int32_t);
+  void subtract_impl(bigdecimal const &, bool);
+
+  friend void swap(bigdecimal & rhs, bigdecimal & lhs) {
+    using std::swap;
+    swap(rhs.is_negative, lhs.is_negative);
+    swap(rhs.scale_, lhs.scale_);
+    swap(rhs.steps_, lhs.steps_);
+    swap(rhs.data, lhs.data);
+  }
+
+  bool is_negative;
+  int32_t scale_{0}, steps_{0};
+  data_type data{};
+};
 }

+ 61 - 61
include/math/biginteger.h

@@ -13,71 +13,71 @@
 #include "number_format.h"
 
 namespace math {
-  class biginteger {
-  private:
-    template <typename Int>
-    using is_signed_t =
-        typename std::enable_if<std::numeric_limits<Int>::is_integer &&
-                                    std::numeric_limits<Int>::is_signed,
-                                int>::type;
-    template <typename Int>
-    using is_unsigned_t =
-        typename std::enable_if<std::numeric_limits<Int>::is_integer &&
-                                    !std::numeric_limits<Int>::is_signed,
-                                int>::type;
+class biginteger {
+private:
+  template <typename Int>
+  using is_signed_t =
+      typename std::enable_if<std::numeric_limits<Int>::is_integer &&
+                                  std::numeric_limits<Int>::is_signed,
+                              int>::type;
+  template <typename Int>
+  using is_unsigned_t =
+      typename std::enable_if<std::numeric_limits<Int>::is_integer &&
+                                  !std::numeric_limits<Int>::is_signed,
+                              int>::type;
 
-  public:
-    using data_type = std::vector<int32_t>;
-    static biginteger const ZERO, ONE, NEGATIVE_ONE;
-    static constexpr int32_t const MAX_SEG{999999999};
-    static constexpr int32_t const OVER_SEG{1000000000};
-    static constexpr int32_t const SEG_DIGITS{9};
+public:
+  using data_type = std::vector<int32_t>;
+  static biginteger const ZERO, ONE, NEGATIVE_ONE;
+  static constexpr int32_t const MAX_SEG{999999999};
+  static constexpr int32_t const OVER_SEG{1000000000};
+  static constexpr int32_t const SEG_DIGITS{9};
 
-  public:
-    // Constructors
-    biginteger();
+public:
+  // Constructors
+  biginteger();
 
-    template <typename Int>
-    biginteger(Int value, is_signed_t<Int> = 0)
-        : biginteger(value < 0,
-                     static_cast<uint64_t>(value < 0 ? -value : value)) {}
+  template <typename Int>
+  biginteger(Int value, is_signed_t<Int> = 0)
+      : biginteger(value < 0,
+                   static_cast<uint64_t>(value < 0 ? -value : value)) {}
 
-    template <typename Int>
-    biginteger(Int value, is_unsigned_t<Int> = 0)
-        : biginteger(false, static_cast<uint64_t>(value)) {}
+  template <typename Int>
+  biginteger(Int value, is_unsigned_t<Int> = 0)
+      : biginteger(false, static_cast<uint64_t>(value)) {}
 
-    biginteger(char const *);
-    // Unary operators
-    biginteger operator-() const;
-    // Binary operators
-    friend biginteger operator+(biginteger, biginteger const &);
-    friend biginteger operator-(biginteger, biginteger const &);
-    friend biginteger operator*(biginteger, biginteger const &);
-    friend biginteger operator/(biginteger, biginteger const &);
-    friend biginteger operator%(biginteger, biginteger const &);
-    friend biginteger & operator+=(biginteger &, biginteger const &);
-    friend biginteger & operator-=(biginteger &, biginteger const &);
-    friend biginteger & operator*=(biginteger &, biginteger const &);
-    friend biginteger & operator/=(biginteger &, biginteger const &);
-    // Output
-    std::string to_string(number_format fmt = {}) const;
-    // Comparison
-    friend bool operator==(biginteger const &, biginteger const &);
-    friend bool operator!=(biginteger const &, biginteger const &);
-    friend bool operator<=(biginteger const &, biginteger const &);
-    friend bool operator<(biginteger const &, biginteger const &);
-    friend bool operator>=(biginteger const &, biginteger const &);
-    friend bool operator>(biginteger const &, biginteger const &);
+  biginteger(char const *);
+  // Unary operators
+  biginteger operator-() const;
+  // Binary operators
+  friend biginteger operator+(biginteger, biginteger const &);
+  friend biginteger operator-(biginteger, biginteger const &);
+  friend biginteger operator*(biginteger, biginteger const &);
+  friend biginteger operator/(biginteger, biginteger const &);
+  friend biginteger operator%(biginteger, biginteger const &);
+  friend biginteger & operator+=(biginteger &, biginteger const &);
+  friend biginteger & operator-=(biginteger &, biginteger const &);
+  friend biginteger & operator*=(biginteger &, biginteger const &);
+  friend biginteger & operator/=(biginteger &, biginteger const &);
+  // Output
+  std::string to_string(number_format fmt = {}) const;
+  // Comparison
+  friend bool operator==(biginteger const &, biginteger const &);
+  friend bool operator!=(biginteger const &, biginteger const &);
+  friend bool operator<=(biginteger const &, biginteger const &);
+  friend bool operator<(biginteger const &, biginteger const &);
+  friend bool operator>=(biginteger const &, biginteger const &);
+  friend bool operator>(biginteger const &, biginteger const &);
 
-  private:
-    biginteger(bool, uint64_t);
-    void subtract_impl(biginteger const & lhs, bool is_sub);
-    friend void swap(biginteger & rhs, biginteger & lhs) {
-      using std::swap;
-      swap(rhs.is_negative, lhs.is_negative);
-      swap(rhs.data, lhs.data);
-    }
-    bool is_negative;
-    data_type data{};
-  };
+private:
+  biginteger(bool, uint64_t);
+  void subtract_impl(biginteger const & lhs, bool is_sub);
+  friend void swap(biginteger & rhs, biginteger & lhs) {
+    using std::swap;
+    swap(rhs.is_negative, lhs.is_negative);
+    swap(rhs.data, lhs.data);
+  }
+  bool is_negative;
+  data_type data{};
+};
 }

+ 10 - 10
include/math/bignum_helper.h

@@ -10,14 +10,14 @@
 #include <vector>
 
 namespace math { namespace detail {
-  using data_type = std::vector<int32_t>;
-  constexpr const int32_t powers[] = {
-      1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1};
-  // 1 => GREATER, 0 => EQUAL, -1 => LESS
-  int compare(data_type const & rhs, data_type const & lhs, size_t offset = 0);
-  void add(data_type & rhs, data_type const & lhs, size_t offset = 0);
-  void subtract_nounderflow(data_type & rhs, data_type const & lhs,
-                            size_t offset = 0);
-  void multiply(data_type & rhs, data_type const & lhs);
-  data_type divide(data_type & remainder, data_type const & divisor);
+using data_type = std::vector<int32_t>;
+constexpr const int32_t powers[] = {1,      10,      100,      1000,      10000,
+                                    100000, 1000000, 10000000, 100000000, 1};
+// 1 => GREATER, 0 => EQUAL, -1 => LESS
+int compare(data_type const & rhs, data_type const & lhs, size_t offset = 0);
+void add(data_type & rhs, data_type const & lhs, size_t offset = 0);
+void subtract_nounderflow(data_type & rhs, data_type const & lhs,
+                          size_t offset = 0);
+void multiply(data_type & rhs, data_type const & lhs);
+data_type divide(data_type & remainder, data_type const & divisor);
 }}

+ 1 - 1
include/math/number_format.h

@@ -10,6 +10,6 @@
 
 namespace math {
 
-  struct number_format {};
+struct number_format {};
 
 }

+ 107 - 107
src/bignum_helper.cpp

@@ -12,9 +12,9 @@
 using namespace math::detail;
 
 namespace {
-  constexpr int32_t const MAX_SEG{999999999};
-  constexpr int32_t const OVER_SEG{1000000000};
-  constexpr int32_t const SEG_DIGITS{9};
+constexpr int32_t const MAX_SEG{999999999};
+constexpr int32_t const OVER_SEG{1000000000};
+constexpr int32_t const SEG_DIGITS{9};
 }
 
 namespace math { namespace detail {
@@ -23,130 +23,130 @@ namespace math { namespace detail {
     return -1;                                                                 \
   else if (lhs lexpr < rhs rexpr)                                              \
   return 1
-  int compare(data_type const & rhs, data_type const & lhs, size_t offset) {
-    IMPL_COMPARE(.size(), .size() + offset);
-    for (size_t i = lhs.size(); i > 0; --i) {
-      IMPL_COMPARE([i + offset - 1], [i - 1]);
-    }
-    return 0;
+int compare(data_type const & rhs, data_type const & lhs, size_t offset) {
+  IMPL_COMPARE(.size(), .size() + offset);
+  for (size_t i = lhs.size(); i > 0; --i) {
+    IMPL_COMPARE([i + offset - 1], [i - 1]);
   }
+  return 0;
+}
 #undef IMPL_COMPARE
 
-  void carry(data_type & rhs, size_t start) {
-    auto const ubnd = rhs.size() - 1;
-    for (size_t i = start; i < ubnd; ++i) {
-      if (rhs[i] > MAX_SEG) {
-        rhs[i] -= OVER_SEG;
-        rhs[i + 1] += 1;
-      }
+void carry(data_type & rhs, size_t start) {
+  auto const ubnd = rhs.size() - 1;
+  for (size_t i = start; i < ubnd; ++i) {
+    if (rhs[i] > MAX_SEG) {
+      rhs[i] -= OVER_SEG;
+      rhs[i + 1] += 1;
     }
-    if (rhs[ubnd] == 0) { rhs.pop_back(); }
   }
+  if (rhs[ubnd] == 0) { rhs.pop_back(); }
+}
 
-  void add(data_type & rhs, data_type const & lhs, size_t offset) {
-    rhs.resize(std::max(rhs.size(), lhs.size() + offset) + 1);
-    auto const lbnd = lhs.size();
-    for (size_t i = 0; i < lbnd; ++i) {
-      rhs[i + offset] += lhs[i];
-    }
-    carry(rhs, offset);
+void add(data_type & rhs, data_type const & lhs, size_t offset) {
+  rhs.resize(std::max(rhs.size(), lhs.size() + offset) + 1);
+  auto const lbnd = lhs.size();
+  for (size_t i = 0; i < lbnd; ++i) {
+    rhs[i + offset] += lhs[i];
   }
+  carry(rhs, offset);
+}
 
-  void add(data_type & rhs, int32_t lhs, size_t offset) {
-    rhs.resize(std::max(rhs.size(), offset) + 1);
-    rhs[offset] += lhs;
-    carry(rhs, offset);
-  }
+void add(data_type & rhs, int32_t lhs, size_t offset) {
+  rhs.resize(std::max(rhs.size(), offset) + 1);
+  rhs[offset] += lhs;
+  carry(rhs, offset);
+}
 
-  void subtract_nounderflow(data_type & rhs, data_type const & lhs,
-                            size_t offset) {
-    size_t const rbnd = rhs.size(), lbnd = lhs.size();
-    // Subtract
-    for (size_t i = 0; i < lbnd; ++i) {
-      rhs[i + offset] -= lhs[i];
-    }
-    // Borrow
-    for (size_t i = 0; i < rbnd - 1; ++i) {
-      if (rhs[i] < 0) {
-        rhs[i] += OVER_SEG;
-        rhs[i + 1] -= 1;
-      }
-    }
-    if (rhs[rbnd - 1] == 0 && rbnd > 1) { rhs.pop_back(); }
+void subtract_nounderflow(data_type & rhs, data_type const & lhs,
+                          size_t offset) {
+  size_t const rbnd = rhs.size(), lbnd = lhs.size();
+  // Subtract
+  for (size_t i = 0; i < lbnd; ++i) {
+    rhs[i + offset] -= lhs[i];
   }
-
-  void multiply(data_type & rhs, data_type const & lhs) {
-    size_t const rbnd = rhs.size(), lbnd = lhs.size();
-    size_t const ubnd = rbnd + lbnd;
-    rhs.resize(ubnd);
-    // Multiply
-    for (size_t i = rbnd; i > 0; --i) {
-      int32_t const value = rhs[i - 1];
-      for (size_t j = lbnd; j > 0; --j) {
-        // Max input              999,999,999
-        // Max output 999,999,998,000,000,001
-        int64_t product = int64_t(value) * lhs[j - 1];
-        int64_t overflow = product / OVER_SEG;
-        size_t const to = i + j - 2;
-        rhs[to] += int32_t(product - (overflow * OVER_SEG));
-        rhs[to + 1] += int32_t(overflow);
-      }
-      rhs[i - 1] -= value;
-    }
-    // Carry
-    for (size_t i = 0; i < ubnd - 1; ++i) {
-      if (rhs[i] > MAX_SEG) {
-        int32_t overflow = rhs[i] / OVER_SEG;
-        rhs[i] -= (overflow * OVER_SEG);
-        rhs[i + 1] += overflow;
-      }
-    }
-    while (rhs.back() == 0) {
-      rhs.pop_back();
+  // Borrow
+  for (size_t i = 0; i < rbnd - 1; ++i) {
+    if (rhs[i] < 0) {
+      rhs[i] += OVER_SEG;
+      rhs[i + 1] -= 1;
     }
   }
+  if (rhs[rbnd - 1] == 0 && rbnd > 1) { rhs.pop_back(); }
+}
 
-  data_type shift10(data_type const & data, int32_t places) {
-    int32_t shift = places / SEG_DIGITS;
-    int64_t const pow = powers[places - (shift * SEG_DIGITS)];
-    size_t const bnd = data.size();
-    data_type rval(size_t((int32_t)bnd + shift) + 1);
-    for (size_t i = 0, o = size_t(std::max(0, shift)); i < bnd; ++i, ++o) {
-      int64_t product = int64_t(data[i]) * pow;
+void multiply(data_type & rhs, data_type const & lhs) {
+  size_t const rbnd = rhs.size(), lbnd = lhs.size();
+  size_t const ubnd = rbnd + lbnd;
+  rhs.resize(ubnd);
+  // Multiply
+  for (size_t i = rbnd; i > 0; --i) {
+    int32_t const value = rhs[i - 1];
+    for (size_t j = lbnd; j > 0; --j) {
+      // Max input              999,999,999
+      // Max output 999,999,998,000,000,001
+      int64_t product = int64_t(value) * lhs[j - 1];
       int64_t overflow = product / OVER_SEG;
-      rval[o] += int32_t(product - (overflow * OVER_SEG));
-      rval[o + 1] += int32_t(overflow);
+      size_t const to = i + j - 2;
+      rhs[to] += int32_t(product - (overflow * OVER_SEG));
+      rhs[to + 1] += int32_t(overflow);
+    }
+    rhs[i - 1] -= value;
+  }
+  // Carry
+  for (size_t i = 0; i < ubnd - 1; ++i) {
+    if (rhs[i] > MAX_SEG) {
+      int32_t overflow = rhs[i] / OVER_SEG;
+      rhs[i] -= (overflow * OVER_SEG);
+      rhs[i + 1] += overflow;
     }
-    if (rval.back() == 0 && rval.size() > 1) { rval.pop_back(); }
-    return rval;
   }
+  while (rhs.back() == 0) {
+    rhs.pop_back();
+  }
+}
 
-  size_t digits(int32_t val) {
-    return val == 0 ? 1 : size_t(floor(log10(val))) + 1;
+data_type shift10(data_type const & data, int32_t places) {
+  int32_t shift = places / SEG_DIGITS;
+  int64_t const pow = powers[places - (shift * SEG_DIGITS)];
+  size_t const bnd = data.size();
+  data_type rval(size_t((int32_t)bnd + shift) + 1);
+  for (size_t i = 0, o = size_t(std::max(0, shift)); i < bnd; ++i, ++o) {
+    int64_t product = int64_t(data[i]) * pow;
+    int64_t overflow = product / OVER_SEG;
+    rval[o] += int32_t(product - (overflow * OVER_SEG));
+    rval[o + 1] += int32_t(overflow);
   }
+  if (rval.back() == 0 && rval.size() > 1) { rval.pop_back(); }
+  return rval;
+}
 
-  size_t digits(data_type const & data) {
-    size_t segDig = SEG_DIGITS * (data.size() - 1);
-    if (data.back() == 0) {
-      return segDig - SEG_DIGITS + digits(data[data.size() - 2]);
-    } else {
-      return segDig + digits(data.back());
-    }
+size_t digits(int32_t val) {
+  return val == 0 ? 1 : size_t(floor(log10(val))) + 1;
+}
+
+size_t digits(data_type const & data) {
+  size_t segDig = SEG_DIGITS * (data.size() - 1);
+  if (data.back() == 0) {
+    return segDig - SEG_DIGITS + digits(data[data.size() - 2]);
+  } else {
+    return segDig + digits(data.back());
   }
+}
 
-  data_type divide(data_type & remainder, data_type const & divisor) {
-    data_type accum{0};
-    auto const dig = digits(divisor);
+data_type divide(data_type & remainder, data_type const & divisor) {
+  data_type accum{0};
+  auto const dig = digits(divisor);
+  do {
+    auto const diff = std::max(1UL, digits(remainder) - dig) - 1;
+    auto const shift = diff / SEG_DIGITS;
+    auto const ipow = diff - (shift * SEG_DIGITS);
+    data_type value{shift10(divisor, int32_t(ipow))};
     do {
-      auto const diff = std::max(1UL, digits(remainder) - dig) - 1;
-      auto const shift = diff / SEG_DIGITS;
-      auto const ipow = diff - (shift * SEG_DIGITS);
-      data_type value{shift10(divisor, int32_t(ipow))};
-      do {
-        subtract_nounderflow(remainder, value, shift);
-        add(accum, powers[ipow], shift);
-      } while (compare(remainder, value, shift) >= 0); // Up to 10 times
-    } while (compare(remainder, divisor) >= 0);
-    return accum;
-  }
+      subtract_nounderflow(remainder, value, shift);
+      add(accum, powers[ipow], shift);
+    } while (compare(remainder, value, shift) >= 0); // Up to 10 times
+  } while (compare(remainder, divisor) >= 0);
+  return accum;
+}
 }}

+ 3 - 3
test/bignumber_test_printers.h

@@ -29,11 +29,11 @@ struct BigDecPair {
 using BigIntPair = std::tuple<math::biginteger, math::biginteger>;
 
 namespace math {
-  void PrintTo(math::bigdecimal const & dec, std::ostream * out);
-  void PrintTo(math::biginteger const & dec, std::ostream * out);
+void PrintTo(math::bigdecimal const & dec, std::ostream * out);
+void PrintTo(math::biginteger const & dec, std::ostream * out);
 }
 void PrintTo(BigDecPair const & tup, std::ostream * out);
 void PrintTo(ArithTuple const & tup, std::ostream * out);
 namespace std {
-  void PrintTo(BigIntPair const & tup, std::ostream * out);
+void PrintTo(BigIntPair const & tup, std::ostream * out);
 }