diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 226b7aa06..e7188c238 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -924,8 +924,8 @@ void BlockChain::checkConsistency() delete it; } -static inline unsigned upow(unsigned a, unsigned b) { while (b-- > 0) a *= a; return a; } -static inline unsigned ceilDiv(unsigned n, unsigned d) { return n / (n + d - 1); } +static inline unsigned upow(unsigned a, unsigned b) { if (!b) return 1; while (--b > 0) a *= a; return a; } +static inline unsigned ceilDiv(unsigned n, unsigned d) { return (n + d - 1) / d; } //static inline unsigned floorDivPow(unsigned n, unsigned a, unsigned b) { return n / upow(a, b); } //static inline unsigned ceilDivPow(unsigned n, unsigned a, unsigned b) { return ceilDiv(n, upow(a, b)); }