From: Gerhard Sittig Date: Fri, 29 Dec 2017 15:06:23 +0000 (+0100) Subject: fx2lafw: silence integer overflow compile warnings X-Git-Tag: sigrok-firmware-fx2lafw-0.1.6~4 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f6ef2ff72979;p=sigrok-firmware-fx2lafw.git fx2lafw: silence integer overflow compile warnings Explicitly mark literals for control bitfield values as unsigned. This avoids a compiler warning when the MSB gets set in assignments to a BYTE. The warning was not seen with SDCC v3.3, but with v3.6.9: SDCC fx2lafw.rel ./source/fx2lafw.c:66: warning 158: overflow in implicit constant conversion SDCC gpif-acquisition.rel ./source/gpif-acquisition.c:65: warning 158: overflow in implicit constant conversion --- diff --git a/fx2lafw.c b/fx2lafw.c index 646c1f15..d601e277 100644 --- a/fx2lafw.c +++ b/fx2lafw.c @@ -56,12 +56,12 @@ volatile WORD ledcounter = 0; static void setup_endpoints(void) { /* Setup EP2 (IN). */ - EP2CFG = (1 << 7) | /* EP is valid/activated */ - (1 << 6) | /* EP direction: IN */ - (1 << 5) | (0 << 4) | /* EP Type: bulk */ - (1 << 3) | /* EP buffer size: 1024 */ - (0 << 2) | /* Reserved. */ - (0 << 1) | (0 << 0); /* EP buffering: quad buffering */ + EP2CFG = (1u << 7) | /* EP is valid/activated */ + (1u << 6) | /* EP direction: IN */ + (1u << 5) | (0u << 4) | /* EP Type: bulk */ + (1u << 3) | /* EP buffer size: 1024 */ + (0u << 2) | /* Reserved. */ + (0u << 1) | (0u << 0); /* EP buffering: quad buffering */ SYNCDELAY(); /* Disable all other EPs (EP1, EP4, EP6, and EP8). */ diff --git a/gpif-acquisition.c b/gpif-acquisition.c index e98cbc54..b526d59d 100644 --- a/gpif-acquisition.c +++ b/gpif-acquisition.c @@ -62,7 +62,7 @@ static void gpif_setup_registers(void) * GPIFWFSELECT: [7:6] = SINGLEWR index, [5:4] = SINGLERD index, * [3:2] = FIFOWR index, [1:0] = FIFORD index */ - GPIFWFSELECT = (0x3 << 6) | (0x2 << 4) | (0x1 << 2) | (0x0 << 0); + GPIFWFSELECT = (0x3u << 6) | (0x2u << 4) | (0x1u << 2) | (0x0u << 0); /* Contains RDY* pin values. Read-only according to TRM. */ GPIFREADYSTAT = 0;