aboutsummaryrefslogtreecommitdiff
path: root/src/uint256.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-03-28 23:51:50 +0100
committerPieter Wuille <pieterw@google.com>2013-04-12 12:17:28 +0200
commit1657c4bc495815febc2137972c3c63b99d2b0189 (patch)
tree57798b51f7014c88f11b1e5bfe11edc123977098 /src/uint256.h
parent2aa462ec30c3960ae546e4d8d50fdbaffefef718 (diff)
downloadbitcoin-1657c4bc495815febc2137972c3c63b99d2b0189.tar.xz
Use a uint256 for bnChainWork
Every block index entry currently requires a separately-allocated CBigNum. By replacing them with uint256, it's just 32 bytes extra in CBlockIndex itself. This should save us a few megabytes in RAM, and less allocation overhead.
Diffstat (limited to 'src/uint256.h')
-rw-r--r--src/uint256.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/uint256.h b/src/uint256.h
index eb0066fa27..8a9af8ba04 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -55,6 +55,16 @@ public:
return ret;
}
+ double getdouble() const
+ {
+ double ret = 0.0;
+ double fact = 1.0;
+ for (int i = 0; i < WIDTH; i++) {
+ ret += fact * pn[i];
+ fact *= 4294967296.0;
+ }
+ return ret;
+ }
base_uint& operator=(uint64 b)
{