File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,7 @@ I ReadVarInt(Stream& is)
386386
387387#define FLATDATA (obj ) REF(CFlatData((char *)&(obj), (char *)&(obj) + sizeof (obj)))
388388#define VARINT (obj ) REF(WrapVarInt(REF(obj)))
389+ #define COMPACTSIZE (obj ) REF(CCompactSize(REF(obj)))
389390#define LIMITED_STRING (obj,n ) REF(LimitedString< n >(REF(obj)))
390391
391392/* *
@@ -456,6 +457,28 @@ class CVarInt
456457 }
457458};
458459
460+ class CCompactSize
461+ {
462+ protected:
463+ uint64_t &n;
464+ public:
465+ CCompactSize (uint64_t & nIn) : n(nIn) { }
466+
467+ unsigned int GetSerializeSize (int , int ) const {
468+ return GetSizeOfCompactSize (n);
469+ }
470+
471+ template <typename Stream>
472+ void Serialize (Stream &s, int , int ) const {
473+ WriteCompactSize<Stream>(s, n);
474+ }
475+
476+ template <typename Stream>
477+ void Unserialize (Stream& s, int , int ) {
478+ n = ReadCompactSize<Stream>(s);
479+ }
480+ };
481+
459482template <size_t Limit>
460483class LimitedString
461484{
You can’t perform that action at this time.
0 commit comments