// ********************************************************************** public long ReadGrowing(long lastValue) { uint offset = ULeb128.Read(BaseStream); if (offset == ULeb128.Max4BValue) { return(lastValue + Leb128.Read(BaseStream)); } else { return(lastValue + offset); } }
// ********************************************************************** public void WriteGrowing(long value, ref long lastValue) { long offset = value - lastValue; if (offset >= ULeb128.Max4BValue || offset < 0) { ULeb128.Write(BaseStream, ULeb128.Max4BValue); Leb128.Write(BaseStream, offset); } else { ULeb128.Write(BaseStream, (uint)offset); } lastValue = value; }