Skip to content

Commit 04a5c03

Browse files
committed
fix int conversion warnings
1 parent ce064de commit 04a5c03

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/common/tusb_fifo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_si
8282
// but limits the maximum depth to 2^16/2 = 2^15 and buffer overflows are detectable
8383
// only if overflow happens once (important for unsupervised DMA applications)
8484
//f->max_pointer_idx = (uint16_t) (2*depth - 1);
85-
f->non_used_index_space = UINT16_MAX - (2*f->depth-1);
85+
f->non_used_index_space = (uint16_t) (UINT16_MAX - (2*f->depth-1));
8686

8787
f->rd_idx = f->wr_idx = 0;
8888

@@ -867,7 +867,7 @@ bool tu_fifo_clear(tu_fifo_t *f)
867867

868868
f->rd_idx = f->wr_idx = 0;
869869
//f->max_pointer_idx = (uint16_t) (2*f->depth-1);
870-
f->non_used_index_space = UINT16_MAX - (2*f->depth-1);
870+
f->non_used_index_space = (uint16_t) (UINT16_MAX - (2*f->depth-1));
871871

872872
_ff_unlock(f->mutex_wr);
873873
_ff_unlock(f->mutex_rd);

src/common/tusb_fifo.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ typedef struct
136136
void * ptr_wrap ; ///< wrapped part start pointer
137137
} tu_fifo_buffer_info_t;
138138

139-
#define TU_FIFO_INIT(_buffer, _depth, _type, _overwritable) \
140-
{ \
141-
.buffer = _buffer, \
142-
.depth = _depth, \
143-
.item_size = sizeof(_type), \
144-
.overwritable = _overwritable, \
145-
.non_used_index_space = UINT16_MAX - (2*(_depth)-1), \
139+
#define TU_FIFO_INIT(_buffer, _depth, _type, _overwritable) \
140+
{ \
141+
.buffer = _buffer, \
142+
.depth = _depth, \
143+
.item_size = sizeof(_type), \
144+
.overwritable = _overwritable, \
145+
.non_used_index_space = (uint16_t)(UINT16_MAX - (2*(_depth)-1)), \
146146
}
147147

148148
#define TU_FIFO_DEF(_name, _depth, _type, _overwritable) \

0 commit comments

Comments
 (0)