summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/tusb_fifo.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index 1e0c6b5e7..f41cf9f6c 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -81,9 +81,8 @@ bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_si
static inline uint16_t _ff_mod(uint16_t idx, uint16_t depth)
{
-// return idx % depth;
- idx -= depth & -(idx >= depth);
- return idx -= depth & -(idx >= depth);
+ while ( idx >= depth) idx -= depth;
+ return idx;
}
// send one item to FIFO WITHOUT updating write pointer