aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-07-22 23:15:22 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2012-07-22 23:15:22 +0000
commit4f620dd0f0d0cd9ae1e2bb0403e07bd303e5b3ba (patch)
tree8dcdd1d39d4ebfd269762fd2e5effb1955672f0c /src
parentb2848bf08a4b6daa67f7fd197aee9f39a08f9b5f (diff)
parentec9a3c04edc5180e20cb25ecd16558f449fa52e0 (diff)
Merge branch '0.4.x' into 0.5.x
Diffstat (limited to 'src')
-rw-r--r--src/bignum.h6
-rw-r--r--src/main.cpp2
-rw-r--r--src/util.cpp6
3 files changed, 8 insertions, 6 deletions
diff --git a/src/bignum.h b/src/bignum.h
index e203b26a05..7db89b30c4 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -130,7 +130,9 @@ public:
if (sn < (int64)0)
{
- n = -sn;
+ // Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate
+ n = -(sn + 1);
+ ++n;
fNegative = true;
} else {
n = sn;
@@ -413,7 +415,7 @@ public:
CBigNum& operator>>=(unsigned int shift)
{
// Note: BN_rshift segfaults on 64-bit if 2^shift is greater than the number
- // if built on ubuntu 9.04 or 9.10, probably depends on version of openssl
+ // if built on ubuntu 9.04 or 9.10, probably depends on version of OpenSSL
CBigNum a = 1;
a <<= shift;
if (BN_cmp(&a, this) > 0)
diff --git a/src/main.cpp b/src/main.cpp
index c705f03125..e1acf59d40 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -697,7 +697,7 @@ int64 static GetBlockValue(int nHeight, int64 nFees)
{
int64 nSubsidy = 50 * COIN;
- // Subsidy is cut in half every 4 years
+ // Subsidy is cut in half every 210000 blocks, which will occur approximately every 4 years
nSubsidy >>= (nHeight / 210000);
return nSubsidy + nFees;
diff --git a/src/util.cpp b/src/util.cpp
index 1f120e18d6..c70b9d9e6e 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -54,7 +54,7 @@ extern "C" void tss_cleanup_implemented() { }
-// Init openssl library multithreading support
+// Init OpenSSL library multithreading support
static boost::interprocess::interprocess_mutex** ppmutexOpenSSL;
void locking_callback(int mode, int i, const char* file, int line)
{
@@ -70,7 +70,7 @@ class CInit
public:
CInit()
{
- // Init openssl library multithreading support
+ // Init OpenSSL library multithreading support
ppmutexOpenSSL = (boost::interprocess::interprocess_mutex**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(boost::interprocess::interprocess_mutex*));
for (int i = 0; i < CRYPTO_num_locks(); i++)
ppmutexOpenSSL[i] = new boost::interprocess::interprocess_mutex();
@@ -86,7 +86,7 @@ public:
}
~CInit()
{
- // Shutdown openssl library multithreading support
+ // Shutdown OpenSSL library multithreading support
CRYPTO_set_locking_callback(NULL);
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];