bitcoin/src/consensus
Andrew Chow 52ddbd52f9
Merge bitcoin/bitcoin#26345: refactor: modernize the implementation of uint256.*
935acdcc79 refactor: modernize the implementation of uint256.* (pasta)

Pull request description:

  - Constructors of uint256 to utilize Span instead of requiring a std::vector
  - converts m_data into a std::array
  - Prefers using `WIDTH` instead of `sizeof(m_data)`
  - make all the things constexpr
  - replace C style functions with c++ equivalents
      - memset -> std::fill
          This may also be replaced by std::memset, but I think that std::fill is more idiomatic of modern c++ and readable.
      - memcpy -> std::copy
          Note: In practice, implementations of std::copy avoid multiple assignments and use bulk copy functions such as std::memmove if the value type is TriviallyCopyable and the iterator types satisfy LegacyContiguousIterator. (https://en.cppreference.com/w/cpp/algorithm/copy)
          This could also likely be replaced by std::memcpy, but as said above, I believe the using std::copy is the more c++ way to do anything and is almost guaranteed to compile to the same asm
      - memcmp -> std::memcmp

ACKs for top commit:
  achow101:
    ACK 935acdcc79
  hebasto:
    Approach ACK 935acdcc79.
  aureleoules:
    reACK 935acdcc79
  john-moffett:
    ACK 935acdcc79
  stickies-v:
    Approach ACK 935acdcc7

Tree-SHA512: 4f1ba54ff2198eea0e505d41e73d552c84c60f6878d5c85a94a8ab57f39afc94ef8d79258e7afd01fa84ec2a99f4404bb877eecd671f65e1ee9273f3129fc650
2023-02-06 13:56:51 -05:00
..
amount.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
consensus.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
merkle.cpp scripted-diff: Bump copyright headers 2020-04-16 13:33:09 -04:00
merkle.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
params.h Merge bitcoin/bitcoin#26345: refactor: modernize the implementation of uint256.* 2023-02-06 13:56:51 -05:00
tx_check.cpp scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
tx_check.h scripted-diff: Bump copyright of files changed in 2019 2019-12-30 10:42:20 +13:00
tx_verify.cpp Sanity assert GetAncestor() != nullptr where appropriate 2022-05-05 15:55:44 +02:00
tx_verify.h doc: fix: prevHeights entries are set to 0, not removed 2022-11-29 17:58:36 +00:00
validation.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00