mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 17:52:47 +01:00
core: cib: fix overflow handling
This commit is contained in:
parent
2c46e0928e
commit
a8ec624ac4
@ -92,7 +92,7 @@ static inline unsigned int cib_full(const cib_t *cib)
|
|||||||
*/
|
*/
|
||||||
static inline int cib_get(cib_t *__restrict 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);
|
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)
|
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);
|
return (int) (cib->read_count & cib->mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user