annotate src/uint256.h @ 2935:7791ca0f682d draft

Merge branch '0.4.x' into 0.5.x Conflicts: src/main.cpp
author Luke Dashjr <luke-jr+git@utopios.org>
date Sun, 22 Apr 2012 10:05:43 -0400
parents 3b9ada19093d 524bed9dc266
children 380b719106a8 2905cb7f86c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
846
228f8c2d9b70 Unify copyright notices.
Matt Corallo <matt@bluematt.me>
parents: 595
diff changeset
2 // Copyright (c) 2011 The Bitcoin developers
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
3 // Distributed under the MIT/X11 software license, see the accompanying
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
4 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
5 #ifndef BITCOIN_UINT256_H
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
6 #define BITCOIN_UINT256_H
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
7
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
8 #include "serialize.h"
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
9
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
10 #include <limits.h>
2934
524bed9dc266 Add missing includes. (Fix bulding under GCC 4.7)
Timothy Redaelli <timothy.redaelli@gmail.com>
parents: 2933
diff changeset
11 #include <stdio.h>
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
12 #include <string>
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
13 #include <vector>
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
14
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
15 #if defined(_MSC_VER) || defined(__BORLANDC__)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
16 typedef __int64 int64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
17 typedef unsigned __int64 uint64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
18 #else
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
19 typedef long long int64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
20 typedef unsigned long long uint64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
21 #endif
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
22 #if defined(_MSC_VER) && _MSC_VER < 1300
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
23 #define for if (false) ; else for
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
24 #endif
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
25
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
26
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
27 inline int Testuint256AdHoc(std::vector<std::string> vArg);
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
28
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
29
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
30
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
31 // We have to keep a separate base class without constructors
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
32 // so the compiler will let us use it in a union
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
33 template<unsigned int BITS>
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
34 class base_uint
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
35 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
36 protected:
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
37 enum { WIDTH=BITS/32 };
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
38 unsigned int pn[WIDTH];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
39 public:
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
40
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
41 bool operator!() const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
42 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
43 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
44 if (pn[i] != 0)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
45 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
46 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
47 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
48
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
49 const base_uint operator~() const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
50 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
51 base_uint ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
52 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
53 ret.pn[i] = ~pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
54 return ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
55 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
56
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
57 const base_uint operator-() const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
58 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
59 base_uint ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
60 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
61 ret.pn[i] = ~pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
62 ret++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
63 return ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
64 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
65
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
66
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
67 base_uint& operator=(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
68 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
69 pn[0] = (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
70 pn[1] = (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
71 for (int i = 2; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
72 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
73 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
74 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
75
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
76 base_uint& operator^=(const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
77 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
78 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
79 pn[i] ^= b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
80 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
81 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
82
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
83 base_uint& operator&=(const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
84 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
85 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
86 pn[i] &= b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
87 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
88 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
89
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
90 base_uint& operator|=(const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
91 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
92 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
93 pn[i] |= b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
94 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
95 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
96
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
97 base_uint& operator^=(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
98 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
99 pn[0] ^= (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
100 pn[1] ^= (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
101 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
102 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
103
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
104 base_uint& operator|=(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
105 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
106 pn[0] |= (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
107 pn[1] |= (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
108 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
109 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
110
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
111 base_uint& operator<<=(unsigned int shift)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
112 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
113 base_uint a(*this);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
114 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
115 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
116 int k = shift / 32;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
117 shift = shift % 32;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
118 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
119 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
120 if (i+k+1 < WIDTH && shift != 0)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
121 pn[i+k+1] |= (a.pn[i] >> (32-shift));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
122 if (i+k < WIDTH)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
123 pn[i+k] |= (a.pn[i] << shift);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
124 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
125 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
126 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
127
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
128 base_uint& operator>>=(unsigned int shift)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
129 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
130 base_uint a(*this);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
131 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
132 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
133 int k = shift / 32;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
134 shift = shift % 32;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
135 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
136 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
137 if (i-k-1 >= 0 && shift != 0)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
138 pn[i-k-1] |= (a.pn[i] << (32-shift));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
139 if (i-k >= 0)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
140 pn[i-k] |= (a.pn[i] >> shift);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
141 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
142 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
143 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
144
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
145 base_uint& operator+=(const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
146 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
147 uint64 carry = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
148 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
149 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
150 uint64 n = carry + pn[i] + b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
151 pn[i] = n & 0xffffffff;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
152 carry = n >> 32;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
153 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
154 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
155 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
156
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
157 base_uint& operator-=(const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
158 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
159 *this += -b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
160 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
161 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
162
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
163 base_uint& operator+=(uint64 b64)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
164 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
165 base_uint b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
166 b = b64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
167 *this += b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
168 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
169 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
170
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
171 base_uint& operator-=(uint64 b64)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
172 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
173 base_uint b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
174 b = b64;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
175 *this += -b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
176 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
177 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
178
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
179
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
180 base_uint& operator++()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
181 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
182 // prefix operator
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
183 int i = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
184 while (++pn[i] == 0 && i < WIDTH-1)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
185 i++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
186 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
187 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
188
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
189 const base_uint operator++(int)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
190 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
191 // postfix operator
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
192 const base_uint ret = *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
193 ++(*this);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
194 return ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
195 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
196
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
197 base_uint& operator--()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
198 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
199 // prefix operator
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
200 int i = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
201 while (--pn[i] == -1 && i < WIDTH-1)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
202 i++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
203 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
204 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
205
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
206 const base_uint operator--(int)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
207 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
208 // postfix operator
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
209 const base_uint ret = *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
210 --(*this);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
211 return ret;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
212 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
213
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
214
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
215 friend inline bool operator<(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
216 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
217 for (int i = base_uint::WIDTH-1; i >= 0; i--)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
218 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
219 if (a.pn[i] < b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
220 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
221 else if (a.pn[i] > b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
222 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
223 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
224 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
225 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
226
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
227 friend inline bool operator<=(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
228 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
229 for (int i = base_uint::WIDTH-1; i >= 0; i--)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
230 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
231 if (a.pn[i] < b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
232 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
233 else if (a.pn[i] > b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
234 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
235 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
236 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
237 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
238
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
239 friend inline bool operator>(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
240 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
241 for (int i = base_uint::WIDTH-1; i >= 0; i--)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
242 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
243 if (a.pn[i] > b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
244 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
245 else if (a.pn[i] < b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
246 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
247 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
248 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
249 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
250
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
251 friend inline bool operator>=(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
252 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
253 for (int i = base_uint::WIDTH-1; i >= 0; i--)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
254 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
255 if (a.pn[i] > b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
256 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
257 else if (a.pn[i] < b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
258 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
259 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
260 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
261 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
262
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
263 friend inline bool operator==(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
264 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
265 for (int i = 0; i < base_uint::WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
266 if (a.pn[i] != b.pn[i])
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
267 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
268 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
269 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
270
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
271 friend inline bool operator==(const base_uint& a, uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
272 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
273 if (a.pn[0] != (unsigned int)b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
274 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
275 if (a.pn[1] != (unsigned int)(b >> 32))
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
276 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
277 for (int i = 2; i < base_uint::WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
278 if (a.pn[i] != 0)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
279 return false;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
280 return true;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
281 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
282
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
283 friend inline bool operator!=(const base_uint& a, const base_uint& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
284 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
285 return (!(a == b));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
286 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
287
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
288 friend inline bool operator!=(const base_uint& a, uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
289 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
290 return (!(a == b));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
291 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
292
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
293
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
294
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
295 std::string GetHex() const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
296 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
297 char psz[sizeof(pn)*2 + 1];
2928
5b48ee639ec8 Fix loop index var types, fixing many minor sign comparison warnings
Jeff Garzik <jeff@garzik.org>
parents: 2912
diff changeset
298 for (unsigned int i = 0; i < sizeof(pn); i++)
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
299 sprintf(psz + i*2, "%02x", ((unsigned char*)pn)[sizeof(pn) - i - 1]);
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
300 return std::string(psz, psz + sizeof(pn)*2);
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
301 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
302
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
303 void SetHex(const char* psz)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
304 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
305 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
306 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
307
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
308 // skip leading spaces
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
309 while (isspace(*psz))
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
310 psz++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
311
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
312 // skip 0x
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
313 if (psz[0] == '0' && tolower(psz[1]) == 'x')
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
314 psz += 2;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
315
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
316 // hex string to uint
2933
ef50ff06f42c Fix bugs on 'unsigned char' platforms.
Dwayne C. Litzenberger <dlitz@dlitz.net>
parents: 2928
diff changeset
317 static unsigned char phexdigit[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0xa,0xb,0xc,0xd,0xe,0xf,0,0,0,0,0,0,0,0,0 };
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
318 const char* pbegin = psz;
2912
99463a72dea3 fix warnings: array subscript is of type 'char' [-Wchar-subscripts]
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 2017
diff changeset
319 while (phexdigit[(unsigned char)*psz] || *psz == '0')
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
320 psz++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
321 psz--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
322 unsigned char* p1 = (unsigned char*)pn;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
323 unsigned char* pend = p1 + WIDTH * 4;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
324 while (psz >= pbegin && p1 < pend)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
325 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
326 *p1 = phexdigit[(unsigned char)*psz--];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
327 if (psz >= pbegin)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
328 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
329 *p1 |= (phexdigit[(unsigned char)*psz--] << 4);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
330 p1++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
331 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
332 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
333 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
334
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
335 void SetHex(const std::string& str)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
336 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
337 SetHex(str.c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
338 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
339
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
340 std::string ToString() const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
341 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
342 return (GetHex());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
343 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
344
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
345 unsigned char* begin()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
346 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
347 return (unsigned char*)&pn[0];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
348 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
349
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
350 unsigned char* end()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
351 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
352 return (unsigned char*)&pn[WIDTH];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
353 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
354
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
355 unsigned int size()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
356 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
357 return sizeof(pn);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
358 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
359
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
360
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
361 unsigned int GetSerializeSize(int nType=0, int nVersion=VERSION) const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
362 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
363 return sizeof(pn);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
364 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
365
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
366 template<typename Stream>
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
367 void Serialize(Stream& s, int nType=0, int nVersion=VERSION) const
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
368 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
369 s.write((char*)pn, sizeof(pn));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
370 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
371
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
372 template<typename Stream>
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
373 void Unserialize(Stream& s, int nType=0, int nVersion=VERSION)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
374 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
375 s.read((char*)pn, sizeof(pn));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
376 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
377
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
378
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
379 friend class uint160;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
380 friend class uint256;
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
381 friend inline int Testuint256AdHoc(std::vector<std::string> vArg);
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
382 };
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
383
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
384 typedef base_uint<160> base_uint160;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
385 typedef base_uint<256> base_uint256;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
386
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
387
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
388
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
389 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
390 // uint160 and uint256 could be implemented as templates, but to keep
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
391 // compile errors and debugging cleaner, they're copy and pasted.
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
392 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
393
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
394
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
395
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
396 //////////////////////////////////////////////////////////////////////////////
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
397 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
398 // uint160
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
399 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
400
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
401 class uint160 : public base_uint160
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
402 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
403 public:
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
404 typedef base_uint160 basetype;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
405
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
406 uint160()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
407 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
408 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
409 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
410 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
411
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
412 uint160(const basetype& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
413 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
414 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
415 pn[i] = b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
416 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
417
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
418 uint160& operator=(const basetype& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
419 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
420 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
421 pn[i] = b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
422 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
423 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
424
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
425 uint160(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
426 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
427 pn[0] = (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
428 pn[1] = (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
429 for (int i = 2; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
430 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
431 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
432
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
433 uint160& operator=(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
434 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
435 pn[0] = (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
436 pn[1] = (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
437 for (int i = 2; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
438 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
439 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
440 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
441
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
442 explicit uint160(const std::string& str)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
443 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
444 SetHex(str);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
445 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
446
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
447 explicit uint160(const std::vector<unsigned char>& vch)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
448 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
449 if (vch.size() == sizeof(pn))
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
450 memcpy(pn, &vch[0], sizeof(pn));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
451 else
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
452 *this = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
453 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
454 };
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
455
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
456 inline bool operator==(const uint160& a, uint64 b) { return (base_uint160)a == b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
457 inline bool operator!=(const uint160& a, uint64 b) { return (base_uint160)a != b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
458 inline const uint160 operator<<(const base_uint160& a, unsigned int shift) { return uint160(a) <<= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
459 inline const uint160 operator>>(const base_uint160& a, unsigned int shift) { return uint160(a) >>= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
460 inline const uint160 operator<<(const uint160& a, unsigned int shift) { return uint160(a) <<= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
461 inline const uint160 operator>>(const uint160& a, unsigned int shift) { return uint160(a) >>= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
462
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
463 inline const uint160 operator^(const base_uint160& a, const base_uint160& b) { return uint160(a) ^= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
464 inline const uint160 operator&(const base_uint160& a, const base_uint160& b) { return uint160(a) &= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
465 inline const uint160 operator|(const base_uint160& a, const base_uint160& b) { return uint160(a) |= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
466 inline const uint160 operator+(const base_uint160& a, const base_uint160& b) { return uint160(a) += b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
467 inline const uint160 operator-(const base_uint160& a, const base_uint160& b) { return uint160(a) -= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
468
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
469 inline bool operator<(const base_uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
470 inline bool operator<=(const base_uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
471 inline bool operator>(const base_uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
472 inline bool operator>=(const base_uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
473 inline bool operator==(const base_uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
474 inline bool operator!=(const base_uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
475 inline const uint160 operator^(const base_uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
476 inline const uint160 operator&(const base_uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
477 inline const uint160 operator|(const base_uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
478 inline const uint160 operator+(const base_uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
479 inline const uint160 operator-(const base_uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
480
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
481 inline bool operator<(const uint160& a, const base_uint160& b) { return (base_uint160)a < (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
482 inline bool operator<=(const uint160& a, const base_uint160& b) { return (base_uint160)a <= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
483 inline bool operator>(const uint160& a, const base_uint160& b) { return (base_uint160)a > (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
484 inline bool operator>=(const uint160& a, const base_uint160& b) { return (base_uint160)a >= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
485 inline bool operator==(const uint160& a, const base_uint160& b) { return (base_uint160)a == (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
486 inline bool operator!=(const uint160& a, const base_uint160& b) { return (base_uint160)a != (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
487 inline const uint160 operator^(const uint160& a, const base_uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
488 inline const uint160 operator&(const uint160& a, const base_uint160& b) { return (base_uint160)a & (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
489 inline const uint160 operator|(const uint160& a, const base_uint160& b) { return (base_uint160)a | (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
490 inline const uint160 operator+(const uint160& a, const base_uint160& b) { return (base_uint160)a + (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
491 inline const uint160 operator-(const uint160& a, const base_uint160& b) { return (base_uint160)a - (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
492
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
493 inline bool operator<(const uint160& a, const uint160& b) { return (base_uint160)a < (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
494 inline bool operator<=(const uint160& a, const uint160& b) { return (base_uint160)a <= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
495 inline bool operator>(const uint160& a, const uint160& b) { return (base_uint160)a > (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
496 inline bool operator>=(const uint160& a, const uint160& b) { return (base_uint160)a >= (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
497 inline bool operator==(const uint160& a, const uint160& b) { return (base_uint160)a == (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
498 inline bool operator!=(const uint160& a, const uint160& b) { return (base_uint160)a != (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
499 inline const uint160 operator^(const uint160& a, const uint160& b) { return (base_uint160)a ^ (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
500 inline const uint160 operator&(const uint160& a, const uint160& b) { return (base_uint160)a & (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
501 inline const uint160 operator|(const uint160& a, const uint160& b) { return (base_uint160)a | (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
502 inline const uint160 operator+(const uint160& a, const uint160& b) { return (base_uint160)a + (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
503 inline const uint160 operator-(const uint160& a, const uint160& b) { return (base_uint160)a - (base_uint160)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
504
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
505
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
506
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
507
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
508
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
509
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
510 //////////////////////////////////////////////////////////////////////////////
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
511 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
512 // uint256
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
513 //
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
514
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
515 class uint256 : public base_uint256
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
516 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
517 public:
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
518 typedef base_uint256 basetype;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
519
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
520 uint256()
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
521 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
522 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
523 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
524 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
525
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
526 uint256(const basetype& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
527 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
528 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
529 pn[i] = b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
530 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
531
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
532 uint256& operator=(const basetype& b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
533 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
534 for (int i = 0; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
535 pn[i] = b.pn[i];
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
536 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
537 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
538
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
539 uint256(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
540 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
541 pn[0] = (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
542 pn[1] = (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
543 for (int i = 2; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
544 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
545 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
546
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
547 uint256& operator=(uint64 b)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
548 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
549 pn[0] = (unsigned int)b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
550 pn[1] = (unsigned int)(b >> 32);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
551 for (int i = 2; i < WIDTH; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
552 pn[i] = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
553 return *this;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
554 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
555
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
556 explicit uint256(const std::string& str)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
557 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
558 SetHex(str);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
559 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
560
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
561 explicit uint256(const std::vector<unsigned char>& vch)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
562 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
563 if (vch.size() == sizeof(pn))
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
564 memcpy(pn, &vch[0], sizeof(pn));
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
565 else
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
566 *this = 0;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
567 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
568 };
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
569
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
570 inline bool operator==(const uint256& a, uint64 b) { return (base_uint256)a == b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
571 inline bool operator!=(const uint256& a, uint64 b) { return (base_uint256)a != b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
572 inline const uint256 operator<<(const base_uint256& a, unsigned int shift) { return uint256(a) <<= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
573 inline const uint256 operator>>(const base_uint256& a, unsigned int shift) { return uint256(a) >>= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
574 inline const uint256 operator<<(const uint256& a, unsigned int shift) { return uint256(a) <<= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
575 inline const uint256 operator>>(const uint256& a, unsigned int shift) { return uint256(a) >>= shift; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
576
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
577 inline const uint256 operator^(const base_uint256& a, const base_uint256& b) { return uint256(a) ^= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
578 inline const uint256 operator&(const base_uint256& a, const base_uint256& b) { return uint256(a) &= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
579 inline const uint256 operator|(const base_uint256& a, const base_uint256& b) { return uint256(a) |= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
580 inline const uint256 operator+(const base_uint256& a, const base_uint256& b) { return uint256(a) += b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
581 inline const uint256 operator-(const base_uint256& a, const base_uint256& b) { return uint256(a) -= b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
582
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
583 inline bool operator<(const base_uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
584 inline bool operator<=(const base_uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
585 inline bool operator>(const base_uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
586 inline bool operator>=(const base_uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
587 inline bool operator==(const base_uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
588 inline bool operator!=(const base_uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
589 inline const uint256 operator^(const base_uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
590 inline const uint256 operator&(const base_uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
591 inline const uint256 operator|(const base_uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
592 inline const uint256 operator+(const base_uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
593 inline const uint256 operator-(const base_uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
594
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
595 inline bool operator<(const uint256& a, const base_uint256& b) { return (base_uint256)a < (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
596 inline bool operator<=(const uint256& a, const base_uint256& b) { return (base_uint256)a <= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
597 inline bool operator>(const uint256& a, const base_uint256& b) { return (base_uint256)a > (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
598 inline bool operator>=(const uint256& a, const base_uint256& b) { return (base_uint256)a >= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
599 inline bool operator==(const uint256& a, const base_uint256& b) { return (base_uint256)a == (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
600 inline bool operator!=(const uint256& a, const base_uint256& b) { return (base_uint256)a != (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
601 inline const uint256 operator^(const uint256& a, const base_uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
602 inline const uint256 operator&(const uint256& a, const base_uint256& b) { return (base_uint256)a & (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
603 inline const uint256 operator|(const uint256& a, const base_uint256& b) { return (base_uint256)a | (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
604 inline const uint256 operator+(const uint256& a, const base_uint256& b) { return (base_uint256)a + (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
605 inline const uint256 operator-(const uint256& a, const base_uint256& b) { return (base_uint256)a - (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
606
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
607 inline bool operator<(const uint256& a, const uint256& b) { return (base_uint256)a < (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
608 inline bool operator<=(const uint256& a, const uint256& b) { return (base_uint256)a <= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
609 inline bool operator>(const uint256& a, const uint256& b) { return (base_uint256)a > (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
610 inline bool operator>=(const uint256& a, const uint256& b) { return (base_uint256)a >= (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
611 inline bool operator==(const uint256& a, const uint256& b) { return (base_uint256)a == (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
612 inline bool operator!=(const uint256& a, const uint256& b) { return (base_uint256)a != (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
613 inline const uint256 operator^(const uint256& a, const uint256& b) { return (base_uint256)a ^ (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
614 inline const uint256 operator&(const uint256& a, const uint256& b) { return (base_uint256)a & (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
615 inline const uint256 operator|(const uint256& a, const uint256& b) { return (base_uint256)a | (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
616 inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
617 inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
618
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
619
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
620
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
621
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
622
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
623
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
624
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
625
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
626
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
627
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
628
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
629
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
630 inline int Testuint256AdHoc(std::vector<std::string> vArg)
575
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
631 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
632 uint256 g(0);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
633
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
634
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
635 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
636 g--; printf("g--\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
637 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
638 g--; printf("g--\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
639 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
640 g++; printf("g++\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
641 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
642 g++; printf("g++\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
643 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
644 g++; printf("g++\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
645 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
646 g++; printf("g++\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
647 printf("%s\n", g.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
648
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
649
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
650
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
651 uint256 a(7);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
652 printf("a=7\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
653 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
654
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
655 uint256 b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
656 printf("b undefined\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
657 printf("%s\n", b.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
658 int c = 3;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
659
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
660 a = c;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
661 a.pn[3] = 15;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
662 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
663 uint256 k(c);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
664
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
665 a = 5;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
666 a.pn[3] = 15;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
667 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
668 b = 1;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
669 b <<= 52;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
670
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
671 a |= b;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
672
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
673 a ^= 0x500;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
674
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
675 printf("a %s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
676
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
677 a = a | b | (uint256)0x1000;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
678
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
679
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
680 printf("a %s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
681 printf("b %s\n", b.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
682
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
683 a = 0xfffffffe;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
684 a.pn[4] = 9;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
685
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
686 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
687 a++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
688 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
689 a++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
690 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
691 a++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
692 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
693 a++;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
694 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
695
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
696 a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
697 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
698 a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
699 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
700 a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
701 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
702 uint256 d = a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
703 printf("%s\n", d.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
704 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
705 a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
706 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
707 a--;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
708 printf("%s\n", a.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
709
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
710 d = a;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
711
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
712 printf("%s\n", d.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
713 for (int i = uint256::WIDTH-1; i >= 0; i--) printf("%08x", d.pn[i]); printf("\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
714
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
715 uint256 neg = d;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
716 neg = ~neg;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
717 printf("%s\n", neg.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
718
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
719
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
720 uint256 e = uint256("0xABCDEF123abcdef12345678909832180000011111111");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
721 printf("\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
722 printf("%s\n", e.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
723
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
724
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
725 printf("\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
726 uint256 x1 = uint256("0xABCDEF123abcdef12345678909832180000011111111");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
727 uint256 x2;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
728 printf("%s\n", x1.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
729 for (int i = 0; i < 270; i += 4)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
730 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
731 x2 = x1 << i;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
732 printf("%s\n", x2.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
733 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
734
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
735 printf("\n");
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
736 printf("%s\n", x1.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
737 for (int i = 0; i < 270; i += 4)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
738 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
739 x2 = x1;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
740 x2 >>= i;
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
741 printf("%s\n", x2.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
742 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
743
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
744
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
745 for (int i = 0; i < 100; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
746 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
747 uint256 k = (~uint256(0) >> i);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
748 printf("%s\n", k.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
749 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
750
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
751 for (int i = 0; i < 100; i++)
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
752 {
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
753 uint256 k = (~uint256(0) << i);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
754 printf("%s\n", k.ToString().c_str());
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
755 }
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
756
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
757 return (0);
1a0476fe825f directory re-organization (keeps the old build system)
Jaromil <jaromil@dyne.org>
parents:
diff changeset
758 }
595
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
759
e630bbb11629 make bitcoin include files more modular
Wladimir J. van der Laan <laanwj@gmail.com>
parents: 575
diff changeset
760 #endif