mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-09 12:12:41 +01:00
Merge branch 'signbugs' of https://github.com/wizeman/bitcoin
Resolved minor conflict in main.cpp
This commit is contained in:
22
src/bignum.h
22
src/bignum.h
@@ -122,16 +122,30 @@ public:
|
||||
return (n > (unsigned long)std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
|
||||
}
|
||||
|
||||
void setint64(int64 n)
|
||||
void setint64(int64 sn)
|
||||
{
|
||||
unsigned char pch[sizeof(n) + 6];
|
||||
unsigned char pch[sizeof(sn) + 6];
|
||||
unsigned char* p = pch + 4;
|
||||
bool fNegative = false;
|
||||
if (n < (int64)0)
|
||||
bool fNegative;
|
||||
uint64 n;
|
||||
|
||||
if (sn < (int64)0)
|
||||
{
|
||||
// We negate in 2 steps to avoid signed subtraction overflow,
|
||||
// i.e. -(-2^63), which is an undefined operation and causes SIGILL
|
||||
// when compiled with -ftrapv.
|
||||
//
|
||||
// Note that uint64_t n = sn, when sn is an int64_t, is a
|
||||
// well-defined operation and n will be equal to sn + 2^64 when sn
|
||||
// is negative.
|
||||
n = sn;
|
||||
n = -n;
|
||||
fNegative = true;
|
||||
} else {
|
||||
n = sn;
|
||||
fNegative = false;
|
||||
}
|
||||
|
||||
bool fLeadingZeroes = true;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user