aboutsummaryrefslogtreecommitdiff
path: root/src/arith_uint256.h
AgeCommit message (Collapse)Author
2024-08-03doc + test: Correct uint256 hex string endiannessHodlinator
Follow-up to #30436. uint256 string representation was wrongfully documented as little-endian due to them being reversed by GetHex() etc, and base_blob::Compare() giving most significance to the beginning of the internal array. They are closer to "big-endian", but this commit tries to be even more precise than that. uint256_tests.cpp - Avoid using variable from the left side of the condition in the right side. setup_common.cpp - Skip needless ArithToUint256-conversion.
2024-07-11Merge bitcoin/bitcoin#30234: Enable clang-tidy checks for self-assignmentmerge-script
26a7f70b5d2b1cbfbf03e0b57b9b5ea92dafbb19 ci: enable self-assignment clang-tidy check (Cory Fields) 32b1d1379258aa57c2a7e278f60d1117fcf17953 refactor: add self-assign checks to classes which violate the clang-tidy check (Cory Fields) Pull request description: See comment here: https://github.com/bitcoin/bitcoin/pull/30161#issuecomment-2148229582 Our code failed these checks in three places, which have been fixed up here. Though these appear to have been harmless, adding the check avoids the copy in the self-assignment case so there should be no downside. ~Additionally, minisketch failed the check as well. See https://github.com/sipa/minisketch/pull/87~ Edit: Done After fixing up the violations, turn on the aggressive clang-tidy check. Note for reviewers: `git diff -w` makes this trivial to review. ACKs for top commit: hebasto: ACK 26a7f70b5d2b1cbfbf03e0b57b9b5ea92dafbb19, I have reviewed the code and it looks OK. TheCharlatan: ACK 26a7f70b5d2b1cbfbf03e0b57b9b5ea92dafbb19 Tree-SHA512: 74d8236a1b5a698f2f61c4740c4fc77788b7f882c4b395acc4e6bfef1ec8a4554ea8821a26b14d70cfa6c8e2e9ea305deeea3fbf323967fa19343c007a53c5ba
2024-07-08tidy: modernize-use-equals-defaultMarcoFalke
2024-06-14refactor: add self-assign checks to classes which violate the clang-tidy checkCory Fields
Both of these cases appear to be harmless, but adding the tests allows us to turn on the aggressive clang-tidy checks.
2023-11-21refactor: Remove unused and fragile string interface from arith_uint256MarcoFalke
2023-02-01Fix clang-tidy readability-const-return-type violationsMarcoFalke
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-04-14Remove duplicate static_assertsMarcoFalke
One should be enough. Can be reviewed with --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-04-05Replace uint256 specific implementations of base_uint::GetHex() and ↵Samer Afach
base_uint::SetHex() with proper ones that don't depend on uint256 and replace template methods instantiations of base_uint with template class instantiation
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-10-15Remove unused includespracticalswift
2018-12-04Use std::numeric_limits<UNSIGNED>::max()) instead of (UNSIGNED)-1practicalswift
2018-07-27Update copyright headers to 2018DrahtBot
2018-06-05Drop uint 256 not operatorBen Woosley
All the other operators are integer or bit operations, and this is unused apart from tests.
2018-02-28[arith_uint256] Avoid unnecessary this-copy using prefix operatorKarl-Johan Alm
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-11-11Merge #10749: Use compile-time constants instead of unnamed enumerations ↵MarcoFalke
(remove "enum hack") 1e65f0f33 Use compile-time constants instead of unnamed enumerations (remove "enum hack") (practicalswift) Pull request description: Use compile-time constants instead of unnamed enumerations (remove "enum hack"). Tree-SHA512: 1b6ebb2755398c5ebab6cce125b1dfc39cbd1504d98d55136b32703fe935c4070360ab3b2f52b1da48ba9f3b01082d204f3d87c92ccb5c8c333731f7f972e128
2017-08-17Prefer compile-time checking over run-time checkingpracticalswift
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
2017-07-26Use compile-time constants instead of unnamed enumerations (remove "enum hack")practicalswift
2017-06-07Fix instantiation and array accesses in class base_uint<BITS>Pavlos Antoniou
The implementation of base_uint::operator++(int) and base_uint::operator--(int) is now safer. Array pn is accessed via index i after bounds checking has been performed on the index, rather than before. The logic of the while loops has also been made more clear. A compile time assertion has been added in the class constructors to ensure that BITS is a positive multiple of 32.
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-11-06[copyright] copyright header style uniformisle2983
Three categories of modifications: 1) 1 instance of 'The Bitcoin Core developers \n', 1 instance of 'the Bitcoin Core developers\n', 3 instances of 'Bitcoin Core Developers\n', and 12 instances of 'The Bitcoin developers\n' are made uniform with the 443 instances of 'The Bitcoin Core developers\n' 2) 3 instances of 'BitPay, Inc\.\n' are made uniform with the other 6 instances of 'BitPay Inc\.\n' 3) 4 instances where there was no '(c)' between the 'Copyright' and the year where it deviates from the style of the local directory.
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-04-20ensure consistent header comment naming conventionsPhilip Kaufmann
- BITCOIN_FOLDER_SUBFOLDER_FILENAME_H
2015-01-05arith_uint256: remove initialization from byte vectorWladimir J. van der Laan
Remove initialization from vector (as this is only used in the tests). Also implement SetHex and GetHex in terms of uint256, to avoid duplicate code as well as avoid endianness issues (as they work in term of bytes).
2015-01-05Remove now-unused methods from arith_uint256 and base_uintWladimir J. van der Laan
- Methods that access the guts of arith_uint256 are removed, as these are incompatible between endians. Use uint256 instead - Serialization is no longer needed as arith_uint256's are never read or written - GetHash is never used on arith_uint256
2015-01-05Remove arith_uint160Wladimir J. van der Laan
We never do 160-bit arithmetic.
2015-01-05Add conversion functions arith_uint256<->uint_256Wladimir J. van der Laan
2015-01-05uint256->arith_uint256 blob256->uint256Wladimir J. van der Laan
Introduce new opaque implementation of `uint256`, move old "arithmetic" implementation to `arith_uint256.
2015-01-05Temporarily add SetNull/IsNull/GetCheapHash to base_uintWladimir J. van der Laan
Also add a stub for arith_uint256 and its conversion functions, for now completely based on uint256. Eases step-by-step migration to blob.