diff options
| author | Jan Dümpelmann <[email protected]> | 2020-04-29 12:37:29 +0200 |
|---|---|---|
| committer | Jan Dümpelmann <[email protected]> | 2020-04-29 12:37:29 +0200 |
| commit | 59ff208c65f1314cdd9691979c849e80920581c1 (patch) | |
| tree | e7a82cae30545bf417ed1c464a89c2d525ef5f8b /src | |
| parent | 3e6feb7f6d59ff500395471561e24b449356e2f1 (diff) | |
Changed switch into if statements
Diffstat (limited to 'src')
| -rw-r--r-- | src/portable/st/synopsys/dcd_synopsys.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c index 39079c9d2..6686c1704 100644 --- a/src/portable/st/synopsys/dcd_synopsys.c +++ b/src/portable/st/synopsys/dcd_synopsys.c @@ -550,14 +550,17 @@ static void transmit_fifo_packet(uint8_t fifo_num, uint8_t * src, uint16_t len){ } // Write the remaining 1-3 bytes into fifo - uint32_t tmp_word = 0; - switch(len & 0x0003){ - case 3: tmp_word |= src[2] << 16; - case 2: tmp_word |= src[1] << 8; - case 1: tmp_word |= src[0]; - *tx_fifo = tmp_word; - break; - default: break; + uint8_t bytes_rem = len & 0x03; + if(bytes_rem){ + uint32_t tmp_word = 0; + tmp_word |= src[0]; + if(bytes_rem > 1){ + tmp_word |= src[1] << 8; + } + if(bytes_rem > 2){ + tmp_word |= src[2] << 16; + } + *tx_fifo = tmp_word; } } |
