diff options
| author | Reinhard Panhuber <[email protected]> | 2020-09-23 21:36:30 +0200 |
|---|---|---|
| committer | Reinhard Panhuber <[email protected]> | 2020-09-23 21:36:30 +0200 |
| commit | 52c9a467b42c4448251753a295343496a9265b4f (patch) | |
| tree | 045b0fe72e94e9ecdd0966fca910c51ae1808724 | |
| parent | 9bdeafb29503b65d2c46e71a4c7e80b753bad55a (diff) | |
Fix bug in modulo substitute.
| -rw-r--r-- | src/common/tusb_fifo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 84fc9bb8b..cf4e6a51a 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -82,8 +82,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); + idx -= depth & -(idx >= depth); + return idx -= depth & -(idx >= depth); } // send one item to FIFO WITHOUT updating write pointer |
