1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 10:12:45 +01:00

core: cib: fix overflow handling

This commit is contained in:
Kaspar Schleiser 2017-11-22 17:53:16 +01:00
parent 2c46e0928e
commit a8ec624ac4

View File

@ -92,7 +92,7 @@ static inline unsigned int cib_full(const cib_t *cib)
*/
static inline int cib_get(cib_t *__restrict cib)
{
if (cib->write_count > cib->read_count) {
if (cib_avail(cib)) {
return (int) (cib->read_count++ & cib->mask);
}
@ -108,7 +108,7 @@ static inline int cib_get(cib_t *__restrict cib)
*/
static inline int cib_peek(cib_t *__restrict cib)
{
if (cib->write_count > cib->read_count) {
if (cib_avail(cib)) {
return (int) (cib->read_count & cib->mask);
}