Skip to content
Snippets Groups Projects
Commit 997fed94 authored by Jonas Gorski's avatar Jonas Gorski
Browse files

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: default avatarJonas Gorski <jonas.gorski@gmail.com>
parent 175fbe4d
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,9 @@ static long to_kbytes(const char *string) { ...@@ -93,7 +93,9 @@ static long to_kbytes(const char *string) {
} }
/* result: number + 1024^(exp) */ /* 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 */ /* convert the sector number into a CHS value for the partition table */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment