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 @@ -373,6 +373,7 @@ I ReadVarInt(Stream& is)
373373
374374#define FLATDATA (obj ) REF(CFlatData((char *)&(obj), (char *)&(obj) + sizeof (obj)))
375375#define VARINT (obj ) REF(WrapVarInt(REF(obj)))
376+ #define COMPACTSIZE (obj ) REF(CCompactSize(REF(obj)))
376377#define LIMITED_STRING (obj,n ) REF(LimitedString< n >(REF(obj)))
377378
378379/* *
@@ -443,6 +444,28 @@ class CVarInt
443444 }
444445};
445446
447+ class CCompactSize
448+ {
449+ protected:
450+ uint64_t &n;
451+ public:
452+ CCompactSize (uint64_t & nIn) : n(nIn) { }
453+
454+ unsigned int GetSerializeSize (int , int ) const {
455+ return GetSizeOfCompactSize (n);
456+ }
457+
458+ template <typename Stream>
459+ void Serialize (Stream &s, int , int ) const {
460+ WriteCompactSize<Stream>(s, n);
461+ }
462+
463+ template <typename Stream>
464+ void Unserialize (Stream& s, int , int ) {
465+ n = ReadCompactSize<Stream>(s);
466+ }
467+ };
468+
446469template <size_t Limit>
447470class LimitedString
448471{
You can’t perform that action at this time.
0 commit comments