Fix off-by-one error in compacting delays

master
Ashley N. 2023-08-25 15:18:08 -04:00
parent 9f9d54d1fd
commit bf9343686a
1 changed files with 1 additions and 1 deletions

View File

@ -405,7 +405,7 @@ pub fn compact_delays( events: Vec<EchoEvent> ) -> Result<Vec<EchoEvent>, Box<dy
let delay_type = *iter.next().ok_or( "internal error: empty event" )?; let delay_type = *iter.next().ok_or( "internal error: empty event" )?;
if delay_type & 0xF0 == ESF_DELAY_SHORT { if delay_type & 0xF0 == ESF_DELAY_SHORT {
cumulative_delay += ( delay_type & 0x0F ) as u16; cumulative_delay += ( ( delay_type & 0x0F ) as u16 ) + 1;
} else if delay_type == ESF_DELAY_LONG { } else if delay_type == ESF_DELAY_LONG {
cumulative_delay += ( *iter.next().ok_or( "internal error: expected delay byte" )? ) as u16; cumulative_delay += ( *iter.next().ok_or( "internal error: expected delay byte" )? ) as u16;
} }