Skip to content

Commit df5862c

Browse files
LessUpqwencoder
andcommitted
fix: 修复range/rust/src/lib.rs的Rust格式化错误
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent e317178 commit df5862c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

range/rust/src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ impl<'a> RangeEncoder<'a> {
140140

141141
fn encode_symbol(&mut self, symbol: u32, cumulative: &[u32]) -> Result<(), RangeError> {
142142
let range = (self.high as u64).wrapping_sub(self.low as u64) + 1;
143-
let total = *cumulative.last().ok_or(RangeError("range: empty cumulative"))? as u64;
143+
let total = *cumulative
144+
.last()
145+
.ok_or(RangeError("range: empty cumulative"))? as u64;
144146
let sym_low = cumulative[symbol as usize] as u64;
145147
let sym_high = cumulative[symbol as usize + 1] as u64;
146148

@@ -206,7 +208,9 @@ impl<'a> RangeDecoder<'a> {
206208
// or prefix-sum index to achieve O(1) symbol lookup.
207209
fn decode_symbol(&mut self, cumulative: &[u32]) -> Result<u32, RangeError> {
208210
let range = (self.high as u64).wrapping_sub(self.low as u64) + 1;
209-
let total = *cumulative.last().ok_or(RangeError("range: empty cumulative"))? as u64;
211+
let total = *cumulative
212+
.last()
213+
.ok_or(RangeError("range: empty cumulative"))? as u64;
210214
let offset = (self.code as u64).wrapping_sub(self.low as u64);
211215
let value = ((offset + 1) * total - 1) / range;
212216

0 commit comments

Comments
 (0)