Merge pull request #13 from danbev/update_credit_seq_max

Use wrapping_sub in update_credit
This commit is contained in:
Dario Nieuwenhuis 2022-09-09 22:11:16 +02:00 committed by GitHub
commit 92136d27f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -916,7 +916,7 @@ where
fn update_credit(&mut self, sdpcm_header: &SdpcmHeader) {
if sdpcm_header.channel_and_flags & 0xf < 3 {
let mut sdpcm_seq_max = sdpcm_header.bus_data_credit;
if sdpcm_seq_max - self.sdpcm_seq > 0x40 {
if sdpcm_seq_max.wrapping_sub(self.sdpcm_seq) > 0x40 {
sdpcm_seq_max = self.sdpcm_seq + 2;
}
self.sdpcm_seq_max = sdpcm_seq_max;