mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-02 04:20:29 +00:00
Change modulo substitute to while ( idx >= depth) idx -= depth;
This commit is contained in:
parent
9ddcfc09d7
commit
8dcb104933
@ -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)
|
static inline uint16_t _ff_mod(uint16_t idx, uint16_t depth)
|
||||||
{
|
{
|
||||||
// return idx % depth;
|
while ( idx >= depth) idx -= depth;
|
||||||
idx -= depth & -(idx >= depth);
|
return idx;
|
||||||
return idx -= depth & -(idx >= depth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// send one item to FIFO WITHOUT updating write pointer
|
// send one item to FIFO WITHOUT updating write pointer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user