@@ -221,7 +221,6 @@ fn count_same_bytes(input: &[u8], cur: &mut usize, source: &[u8], candidate: usi
221221/// to produce a total length. When the byte value is 255, another byte must read and added, and so
222222/// on. There can be any number of bytes of value "255" following token
223223#[ inline]
224- #[ cfg( feature = "safe-encode" ) ]
225224fn write_integer ( output : & mut impl Sink , mut n : usize ) {
226225 // Note: Since `n` is usually < 0xFF and writing multiple bytes to the output
227226 // requires 2 branches of bound check (due to the possibility of add overflows)
@@ -233,36 +232,6 @@ fn write_integer(output: &mut impl Sink, mut n: usize) {
233232 push_byte ( output, n as u8 ) ;
234233}
235234
236- /// Write an integer to the output.
237- ///
238- /// Each additional byte then represent a value from 0 to 255, which is added to the previous value
239- /// to produce a total length. When the byte value is 255, another byte must read and added, and so
240- /// on. There can be any number of bytes of value "255" following token
241- #[ inline]
242- #[ cfg( not( feature = "safe-encode" ) ) ]
243- fn write_integer ( output : & mut impl Sink , mut n : usize ) {
244- // Write the 0xFF bytes as long as the integer is higher than said value.
245- if n >= 4 * 0xFF {
246- // In this unlikelly branch we use a fill instead of a loop,
247- // otherwise rustc may output a large unrolled/vectorized loop.
248- let bulk = n / ( 4 * 0xFF ) ;
249- n %= 4 * 0xFF ;
250- unsafe {
251- core:: ptr:: write_bytes ( output. pos_mut_ptr ( ) , 0xFF , 4 * bulk) ;
252- output. set_pos ( output. pos ( ) + 4 * bulk) ;
253- }
254- }
255-
256- // Handle last 1 to 4 bytes
257- push_u32 ( output, 0xFFFFFFFF ) ;
258- // Updating output len for the remainder
259- unsafe {
260- output. set_pos ( output. pos ( ) - 4 + 1 + n / 255 ) ;
261- // Write the remaining byte.
262- * output. pos_mut_ptr ( ) . sub ( 1 ) = ( n % 255 ) as u8 ;
263- }
264- }
265-
266235/// Handle the last bytes from the input as literals
267236#[ cold]
268237fn handle_last_literals ( output : & mut impl Sink , input : & [ u8 ] , start : usize ) {
@@ -549,15 +518,6 @@ fn push_u16(output: &mut impl Sink, el: u16) {
549518 }
550519}
551520
552- #[ inline]
553- #[ cfg( not( feature = "safe-encode" ) ) ]
554- fn push_u32 ( output : & mut impl Sink , el : u32 ) {
555- unsafe {
556- core:: ptr:: copy_nonoverlapping ( el. to_le_bytes ( ) . as_ptr ( ) , output. pos_mut_ptr ( ) , 4 ) ;
557- output. set_pos ( output. pos ( ) + 4 ) ;
558- }
559- }
560-
561521#[ inline( always) ] // (always) necessary otherwise compiler fails to inline it
562522#[ cfg( feature = "safe-encode" ) ]
563523fn copy_literals_wild ( output : & mut impl Sink , input : & [ u8 ] , input_start : usize , len : usize ) {
0 commit comments