aboutsummaryrefslogtreecommitdiff
path: root/src/bignum.h
AgeCommit message (Collapse)Author
2012-12-17Fix two typos in main.hfanquake
Break one long comment down into 3 lines so it's readable.
2012-12-12Merge pull request #1825 from roques/bignum2Gavin Andresen
Bignum2
2012-09-17reimplement CBigNum's compact encoding of difficulty targetsChristian von Roques
Use shifts instead of going through the MPI representation of BIGNUMs. Be careful to keep the meaning of 0x00800000 as sign bit.
2012-09-10HexStr: don't build a vector<char> firstWladimir J. van der Laan
Also const correctness for lookup tables in hex functions throughout the code.
2012-07-21fix OpenSSL not written as proper noun in some commentsPhilip Kaufmann
2012-07-11Merge pull request #1497 from luke-jr/bugfix_neguintGregory Maxwell
CBigNum: Convert negative int64 values in a more well-defined way
2012-06-18CBigNum: Convert negative int64 values in a more well-defined wayLuke Dashjr
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
2012-06-18Merge branch 'signbugs' of https://github.com/wizeman/bitcoinGavin Andresen
Resolved minor conflict in main.cpp
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-14Fix signed subtraction overflow in CBigNum::setint64().Ricardo M. Correia
As noticed by sipa (Pieter Wuille), this can happen when CBigNum::setint64() is called with an integer value of INT64_MIN (-2^63). When compiled with -ftrapv, the program would crash. Otherwise, it would execute an undefined operation (although in practice, usually the correct one).
2012-05-14Don't overflow signed ints in CBigNum::setint64().Ricardo M. Correia
CBigNum::setint64() does 'n <<= 8', where n is of type "long long". This leads to shifting onto and past the sign bit, which is undefined behavior in C++11 and can cause problems in the future.
2012-04-23Add casts for unavoidable signed/unsigned comparisonsJeff Garzik
At these code sites, it is preferable to cast rather than change a variable's type.
2012-04-22Prefer 'unsigned int' for loop index variables tested against ::size()Jeff Garzik
C++ STL ::size() generally returns unsigned, which implies that "int idx" style of loop variable will generate a signed-vs-unsigned comparison warning when testing the loop exit condition "idx < blah.size()" Update areas of the bitcoin code where loop variables may be more properly and correctly defined as unsigned.
2012-04-18Fix bugs on 'unsigned char' platforms.Dwayne C. Litzenberger
In ISO C++, the signedness of 'char' is undefined. On some platforms (e.g. ARM), 'char' is an unsigned type, but some of the code relies on 'char' being signed (as it is on x86). This is indicated by compiler warnings like this: bignum.h: In constructor 'CBigNum::CBigNum(char)': bignum.h:81:59: warning: comparison is always true due to limited range of data type [-Wtype-limits] util.cpp: In function 'bool IsHex(const string&)': util.cpp:427:28: warning: comparison is always false due to limited range of data type [-Wtype-limits] In particular, IsHex erroneously returned true regardless of the input characters, as long as the length of the string was a positive multiple of 2. Note: For testing, it's possible using GCC to force char to be unsigned by adding the -funsigned-char parameter to xCXXFLAGS.
2012-04-17Remove headers.hPieter Wuille
2012-04-15fix warnings: array subscript is of type 'char' [-Wchar-subscripts]Wladimir J. van der Laan
2012-03-30fixed typo in comment in netbase.h and bignum.hPhilip Kaufmann
2012-03-26Begin doxygen-compatible commentsPieter Wuille
2012-02-18Workaround for BN_bn2mpi reading/writing out of boundsPieter Wuille
When OpenSSL's BN_bn2mpi is passed a buffer of size 4, valgrind reports reading/writing one byte past it. I am unable to find evidence of this behaviour in BN_bn2mpi's source code, so it may be a spurious warning. However, this change is harmless, as only the bignum with value 0 results in an mpi serialization of size 4.
2012-02-07Update all copyrights to 2012Gavin Andresen
2011-12-21Revert "Use standard C99 (and Qt) types for 64-bit integers"Wladimir J. van der Laan
This reverts commit 21d9f36781604e4ca9fc35dc65265593423b73e9.
2011-12-20Use standard C99 (and Qt) types for 64-bit integersLuke Dashjr
2011-12-19Use std::numeric_limits<> for typesafe INT_MAX/etcGavin Andresen
2011-12-19Implement BIP 14 : separate protocol version from client versionGavin Andresen
2011-08-09Unify copyright notices.Matt Corallo
To a variation on: // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2011 The Bitcoin developers
2011-06-06Demystify a few magic numbers.Doug Huff
2011-05-15make bitcoin include files more modularWladimir J. van der Laan
2011-04-23directory re-organization (keeps the old build system)Jaromil
there is no internal modification of any file in this commit files are moved into directories according to established standards in sourcecode distribution; these directories contain: src - Files that are used in constructing the executable binaries, but are not installed. doc - Files in HTML and text format that document usage, quirks of the implementation, and contributor checklists. locale - Files that contain human language translation of strings used in the program contrib - Files contributed from distributions or other third party implementing scripts and auxiliary programs