Merge #12886: Introduce Span type and use it instead of FLATDATA

9272d70 Support serializing Span<unsigned char> and use that instead of FLATDATA (Pieter Wuille)
833bc08 Add Slice: a (pointer, size) array view that acts like a container (Pieter Wuille)

Pull request description:

  Introduce a new data type `Span`, which is an encapsulated pointer + size (like C++20's `std::span` or LevelDB's `Slice`), and represents a view to a sequence of objects laid out continuously in memory.

  The immediate use case is replacing the remaining `FLATDATA` invocations. Instead of those, we support serializing/deserializing unsigned char `Span`s (treating them as arrays).

  A longer term goal for `Span`s is making the script execution operate on them rather than on `CScript` itself. This will allow separate storage mechanisms for scripts.

Tree-SHA512: 7b0da3c802e5df367f223275004d16b04262804c007b7c73fda927176f0a9c3b2ef3225fa842cb73500b0df73175ec1419f1f5239de2402e21dd9ae8e5d05233
This commit is contained in:
Wladimir J. van der Laan
2018-04-08 17:57:22 +02:00
5 changed files with 57 additions and 48 deletions

View File

@@ -316,6 +316,7 @@ libbitcoin_consensus_a_SOURCES = \
script/script_error.cpp \
script/script_error.h \
serialize.h \
span.h \
tinyformat.h \
uint256.cpp \
uint256.h \