File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments