From 543aa3f963c2d6b08dc0b06b6b03c396eb5edebb Mon Sep 17 00:00:00 2001 From: Dennis Boone Date: Mon, 22 Jun 2020 23:54:22 -0400 Subject: [PATCH] Fix link fail on x64-64 Weird gcc behavior. Code snippet: uint16_t data; char ch; ... i = (data >> 8) & 0xff; ch = data & 0xff; ... fprintf(smlclog, "%s OTA '01%02o line '%02o set special character %d <%02x>\n", smlctimestamp, device, dc[dx].lineno, i, ch); Output on x86-64 before this change: 17:13:51 OTA '0150 line '02 set special character 3 Output on armhf or on x86-64 after this change: 19:05:00.130466808 OTA '0150 line '02 set special character 3 WTH? Masking an unsigned with an appropriately sized mask produces a sign extension? --- devsmlc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devsmlc.h b/devsmlc.h index 2c8de8e..abf35ef 100644 --- a/devsmlc.h +++ b/devsmlc.h @@ -250,7 +250,7 @@ int devsmlc (int class, int func, int device) { char *bp; char buf[SMLC_BUFSIZE]; int bufidx; - char ch; + unsigned char ch; time_t currenttime; uint16_t data; ea_t dmcbufbegea;