diff options
| author | Reinhard Panhuber <[email protected]> | 2021-01-18 17:54:08 +0100 |
|---|---|---|
| committer | Reinhard Panhuber <[email protected]> | 2021-01-18 17:54:08 +0100 |
| commit | 99e6bc37207bc3239d00fc7e47e42b8d22b8adff (patch) | |
| tree | 1fd90450252cab47002632fef5b73fb870937c67 /src/common | |
| parent | 595a88b34c700bfdb5bf2db04c731de06a995f5f (diff) | |
Explicitly add cast to uint32_t before shifting uint8 to left
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_fifo.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c index 522fc1883..ca03864eb 100644 --- a/src/common/tusb_fifo.c +++ b/src/common/tusb_fifo.c @@ -135,7 +135,7 @@ static void _tu_fifo_write_to_const_dst_ptr(void * dst, const void * src, uint16 // Pushing full available 32 bit words to FIFO uint16_t full_words = len >> 2; for(uint16_t i = 0; i < full_words; i++){ - *tx_fifo = (src_u8[3] << 24) | (src_u8[2] << 16) | (src_u8[1] << 8) | src_u8[0]; + *tx_fifo = ((uint32_t)(src_u8[3]) << 24) | ((uint32_t)(src_u8[2]) << 16) | ((uint32_t)(src_u8[1]) << 8) | (uint32_t)src_u8[0]; src_u8 += 4; } @@ -145,10 +145,10 @@ static void _tu_fifo_write_to_const_dst_ptr(void * dst, const void * src, uint16 uint32_t tmp_word = 0; tmp_word |= src_u8[0]; if(bytes_rem > 1){ - tmp_word |= src_u8[1] << 8; + tmp_word |= (uint32_t)(src_u8[1]) << 8; } if(bytes_rem > 2){ - tmp_word |= src_u8[2] << 16; + tmp_word |= (uint32_t)(src_u8[2]) << 16; } *tx_fifo = tmp_word; } |
