projects
/
openwrt
/
staging
/
thess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
175fbe4
)
ptgen: work around gcc miscompilation
author
Jonas Gorski
<jonas.gorski@gmail.com>
Mon, 12 Sep 2016 10:59:21 +0000
(12:59 +0200)
committer
Jonas Gorski
<jonas.gorski@gmail.com>
Mon, 26 Sep 2016 10:23:41 +0000
(12:23 +0200)
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>
tools/firmware-utils/src/ptgen.c
patch
|
blob
|
history
diff --git
a/tools/firmware-utils/src/ptgen.c
b/tools/firmware-utils/src/ptgen.c
index 04f4ec862980fb4995b3e2f25f29062ecf1efb57..8466d35bcc3f5364c318594b092ead2aae9e95b9 100644
(file)
--- 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 */