Merge #12752: [MOVEONLY] Move compressor utility functions out of class

76a9aac Move compressor utility functions out of class (Pieter Wuille)

Pull request description:

  This is a refactor from #10785 with no functionality change.

  Move the compresion utility functions out of CScriptCompressor, as a preparation for making the class templated. I'm submitting it as a separate PR as I think it's a general improvement to code readability, and to reduce the diff further on.

Tree-SHA512: 3b3d17c2b96e43f752f512dd573296a6bb15cae165fbe3c79212a0970f5196a62a59a821d5100f29638af1e7461c9171f3dccb8112f005ee08da0ec7fe0073fd
This commit is contained in:
Wladimir J. van der Laan
2018-03-30 12:51:57 +02:00
3 changed files with 33 additions and 36 deletions

View File

@@ -25,16 +25,16 @@
BOOST_FIXTURE_TEST_SUITE(compress_tests, BasicTestingSetup)
bool static TestEncode(uint64_t in) {
return in == CTxOutCompressor::DecompressAmount(CTxOutCompressor::CompressAmount(in));
return in == DecompressAmount(CompressAmount(in));
}
bool static TestDecode(uint64_t in) {
return in == CTxOutCompressor::CompressAmount(CTxOutCompressor::DecompressAmount(in));
return in == CompressAmount(DecompressAmount(in));
}
bool static TestPair(uint64_t dec, uint64_t enc) {
return CTxOutCompressor::CompressAmount(dec) == enc &&
CTxOutCompressor::DecompressAmount(enc) == dec;
return CompressAmount(dec) == enc &&
DecompressAmount(enc) == dec;
}
BOOST_AUTO_TEST_CASE(compress_amounts)