some overflows in debug mode

This commit is contained in:
Alex Janka 2023-03-19 10:23:55 +11:00
parent 608817e3b7
commit 279ffb1a7f

View file

@ -217,7 +217,7 @@ impl PwmChannel {
pub(super) fn length_tick(&mut self) {
if self.length_enable {
self.length_timer += 1;
self.length_timer = self.length_timer.saturating_add(1);
if self.length_timer >= 64 {
self.enabled = false;
}
@ -502,7 +502,7 @@ impl Lfsr {
}
fn tick(&mut self) {
self.timer += 1;
self.timer = self.timer.saturating_add(1);
if self.timer > self.interval {
self.timer = 0;
self.next_value();
@ -598,7 +598,7 @@ impl NoiseChannel {
pub(super) fn length_tick(&mut self) {
if self.length_enable {
self.length_timer += 1;
self.length_timer = self.length_timer.saturating_add(1);
if self.length_timer >= 64 {
self.enabled = false;
}