8000 Merge pull request #2320 from jepler/nrf-unsigned-audio-crash · adafruit/circuitpython@d154d11 · GitHub
[go: up one dir, main page]

Skip to content

Commit d154d11

Browse files
authored
Merge pull request #2320 from jepler/nrf-unsigned-audio-crash
nrf: i2sout: Fix double-increment when copying samples
2 parents 6e3b363 + c9946df commit d154d11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ports/nrf/common-hal/audiobusio/I2SOut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ static void i2s_buffer_fill(audiobusio_i2sout_obj_t* self) {
139139
uint16_t *bp = (uint16_t*)buffer;
140140
uint16_t *be = (uint16_t*)(buffer + bytecount);
141141
uint16_t *sp = (uint16_t*)self->sample_data;
142-
for (; bp != be; bp++) {
142+
for (; bp < be;) {
143143
*bp++ = *sp++ + 0x8000;
144144
}
145145
} else {
146146
uint8_t *bp = (uint8_t*)buffer;
147147
uint8_t *be = (uint8_t*)(buffer + bytecount);
148148
uint8_t *sp = (uint8_t*)self->sample_data;
149-
for (; bp != be; bp++) {
149+
for (; bp < be;) {
150150
*bp++ = *sp++ + 0x80;
151151
}
152152
}

0 commit comments

Comments
 (0)
0