Skip to content

Commit 59e9857

Browse files
committed
fix
1 parent a1e954a commit 59e9857

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/encoding/integer/rle_v1.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,21 @@ impl<N: NInt, S: EncodingSign> RleV1Encoder<N, S> {
191191
///
192192
/// 1. `RleV1EncoderState::Empty`:
193193
/// - Transitions to the `Literal` state with the given value as the first element in the buffer.
194-
/// 2. `RleV1EncoderState::Literal`:
195-
/// - The value is added to the buffer. If the buffer length reaches `MAX_LITERAL_LENGTH`, the buffer is written out
196-
/// and the state transitions to `Empty`.
197-
/// - If the buffer length is at least `MIN_RUN_LENGTH` and the values in the buffer form a valid run (i.e., the deltas
198-
/// between consecutive values are consistent and within the allowed range), the state transitions to `Run`.
199-
/// - Otherwise, the state remains `Literal`.
200-
/// 3. `RleV1EncoderState::Run`:
194+
///
195+
/// 2. `RleV1EncoderState::Run`:
201196
/// - If the value continues the current run (i.e., it matches the expected value based on the run's delta and length),
202197
/// the run length is incremented. If the run length reaches `MAX_RUN_LENGTH`, the run is written out and the state
203198
/// transitions to `Empty`.
204199
/// - If the value does not continue the current run, the existing run is written out and the state transitions to
205200
/// `Literal` with the new value as the first element in the buffer.
206201
///
207-
202+
/// 3. `RleV1EncoderState::Literal`:
203+
/// - The value is added to the buffer. If the buffer length reaches `MAX_LITERAL_LENGTH`, the buffer is written out
204+
/// and the state transitions to `Empty`.
205+
/// - If the buffer length is at least `MIN_RUN_LENGTH` and the values in the buffer form a valid run (i.e., the deltas
206+
/// between consecutive values are consistent and within the allowed range), the state transitions to `Run`.
207+
/// - Otherwise, the state remains `Literal`.
208+
///
208209
fn process_value(&mut self, value: N) {
209210
match &mut self.state {
210211
RleV1EncodingState::Empty => {
@@ -271,12 +272,12 @@ impl<N: NInt, S: EncodingSign> RleV1Encoder<N, S> {
271272
/// 1. `RleV1EncoderState::Empty`:
272273
/// - No action is needed as there are no buffered values to write.
273274
///
274-
/// 2. `RleV1EncoderState::Run`:
275-
/// - Writes out the current run of values.
276-
///
277275
/// 3. `RleV1EncoderState::Literal`:
278276
/// - Writes out the buffered literal values.
279277
///
278+
/// 2. `RleV1EncoderState::Run`:
279+
/// - Writes out the current run of values.
280+
///
280281
/// After calling this function, the encoder state will be reset to `Empty`.
281282
fn flush(&mut self) {
282283
let state = std::mem::take(&mut self.state);

0 commit comments

Comments
 (0)