Changeset View
Changeset View
Standalone View
Standalone View
src/blockencodings.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
if (n > std::numeric_limits<uint32_t>::max()) { | if (n > std::numeric_limits<uint32_t>::max()) { | ||||
throw std::ios_base::failure( | throw std::ios_base::failure( | ||||
"index overflowed 32 bits"); | "index overflowed 32 bits"); | ||||
} | } | ||||
indices[i] = n; | indices[i] = n; | ||||
} | } | ||||
} | } | ||||
uint32_t offset = 0; | uint64_t offset = 0; | ||||
for (auto &index : indices) { | for (auto &index : indices) { | ||||
if (uint64_t(index) + uint64_t(offset) > | if (uint64_t(index) + offset > | ||||
std::numeric_limits<uint32_t>::max()) { | std::numeric_limits<uint32_t>::max()) { | ||||
throw std::ios_base::failure("indices overflowed 32 bits"); | throw std::ios_base::failure("indices overflowed 32 bits"); | ||||
} | } | ||||
index = index + offset; | index = index + offset; | ||||
offset = index + 1; | offset = uint64_t(index) + 1; | ||||
} | } | ||||
} else { | } else { | ||||
for (size_t i = 0; i < indices.size(); i++) { | for (size_t i = 0; i < indices.size(); i++) { | ||||
uint64_t index = | uint64_t index = | ||||
indices[i] - (i == 0 ? 0 : (indices[i - 1] + 1)); | indices[i] - (i == 0 ? 0 : (indices[i - 1] + 1)); | ||||
READWRITE(COMPACTSIZE(index)); | READWRITE(COMPACTSIZE(index)); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | inline void SerializationOp(Stream &s, Operation ser_action) { | ||||
uint16_t msb = (shortid >> 32) & 0xffff; | uint16_t msb = (shortid >> 32) & 0xffff; | ||||
READWRITE(lsb); | READWRITE(lsb); | ||||
READWRITE(msb); | READWRITE(msb); | ||||
} | } | ||||
} | } | ||||
READWRITE(prefilledtxn); | READWRITE(prefilledtxn); | ||||
if (BlockTxCount() > std::numeric_limits<uint32_t>::max()) { | |||||
throw std::ios_base::failure("indices overflowed 32 bits"); | |||||
} | |||||
if (ser_action.ForRead()) { | if (ser_action.ForRead()) { | ||||
FillShortTxIDSelector(); | FillShortTxIDSelector(); | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
class PartiallyDownloadedBlock { | class PartiallyDownloadedBlock { | ||||
protected: | protected: | ||||
Show All 21 Lines |