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>
This commit is contained in:
parent
175fbe4d4e
commit
997fed94e3
1 changed files with 3 additions and 1 deletions
|
@ -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 */
|
||||||
|
|
Loading…
Reference in a new issue