Skip to content

Commit

Permalink
i2c: remove modulo from queue empty and full API
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed May 14, 2024
1 parent 79ea0e6 commit f1b04e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/sddf/i2c/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static inline i2c_queue_handle_t i2c_queue_init(i2c_queue_t *request, i2c_queue_
*/
static inline int i2c_queue_empty(i2c_queue_t *queue)
{
return !((queue->tail - queue->head) % NUM_QUEUE_ENTRIES);
return queue->tail - queue->head == 0;
}

/**
Expand All @@ -105,7 +105,7 @@ static inline int i2c_queue_empty(i2c_queue_t *queue)
*/
static inline int i2c_queue_full(i2c_queue_t *queue)
{
return !((queue->tail - queue->head + 1) % NUM_QUEUE_ENTRIES);
return queue->tail - queue->head + 1 = NUM_QUEUE_ENTRIES;
}

static inline uint32_t i2c_queue_size(i2c_queue_t *queue)
Expand Down

0 comments on commit f1b04e4

Please sign in to comment.