| 17 | { |
| 18 | template <typename T, typename Source> |
| 19 | T ReadDelta(BitReader<Source> & reader) |
| 20 | { |
| 21 | static_assert(std::is_unsigned<T>::value, "T should be an unsigned type"); |
| 22 | uint64_t const decoded = coding::DeltaCoder::Decode(reader); |
| 23 | if (decoded > std::numeric_limits<T>::max()) |
| 24 | MYTHROW(CorruptedDataException, ("Decoded value", decoded, "out of limit", std::numeric_limits<T>::max())); |
| 25 | |
| 26 | return static_cast<T>(decoded); |
| 27 | } |
| 28 | |
| 29 | template <typename T, typename Sink> |
| 30 | void WriteDelta(BitWriter<Sink> & writer, T value) |