aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2016-09-12 12:59:21 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2016-09-26 12:23:41 +0200
commit997fed94e328315c6055331dbd8d6d4b56d1b454 (patch)
treef0405afd37120567a6dc546ca8c4ddd45557690d /tools
parent175fbe4d4ec4978ff1341f24ce3811d673c91a85 (diff)
downloadupstream-997fed94e328315c6055331dbd8d6d4b56d1b454.tar.gz
upstream-997fed94e328315c6055331dbd8d6d4b56d1b454.tar.bz2
upstream-997fed94e328315c6055331dbd8d6d4b56d1b454.zip
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 <jonas.gorski@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/firmware-utils/src/ptgen.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/firmware-utils/src/ptgen.c b/tools/firmware-utils/src/ptgen.c
index 04f4ec8629..8466d35bcc 100644
--- a/tools/firmware-utils/src/ptgen.c
+++ b/tools/firmware-utils/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 */