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)
373
373
374
374
#define FLATDATA(obj) REF(CFlatData((char*)&(obj), (char*)&(obj) + sizeof(obj)))
375
375
#define VARINT(obj) REF(WrapVarInt(REF(obj)))
376
+ #define COMPACTSIZE(obj) REF(CCompactSize(REF(obj)))
376
377
#define LIMITED_STRING(obj,n) REF(LimitedString< n >(REF(obj)))
377
378
378
379
/**
@@ -443,6 +444,28 @@ class CVarInt
443
444
}
444
445
};
445
446
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
+
446
469
template<size_t Limit>
447
470
class LimitedString
448
471
{
You can’t perform that action at this time.
0 commit comments