From: Jonas Gorski Date: Mon, 12 Sep 2016 10:59:21 +0000 (+0200) Subject: ptgen: work around gcc miscompilation X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=fa6b0cefbb3d52ebbc0fa5bf7b3b84001a5a3f32;p=project%2Ffirmware-utils.git ptgen: work around gcc miscompilation Some gcc versions seem to miscompile code using ternary operators, work around this by just returning the result if exp is 0. Signed-off-by: Jonas Gorski --- diff --git a/src/ptgen.c b/src/ptgen.c index 04f4ec8..8466d35 100644 --- a/src/ptgen.c +++ b/src/ptgen.c @@ -93,7 +93,9 @@ static long to_kbytes(const char *string) { } /* result: number + 1024^(exp) */ - return result * ((2 << ((10 * exp) - 1)) ?: 1); + if (exp == 0) + return result; + return result * (2 << ((10 * exp) - 1)); } /* convert the sector number into a CHS value for the partition table */