mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 05:46:45 +00:00
[libc] Workaround for gcc complaining about implicit conversions with the ternary ?: operator. (#124820)
Fixes https://github.com/llvm/llvm-project/issues/120427, https://github.com/llvm/llvm-project/issues/122745 This is caused by a -Wconversion false-positive bug in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101537
This commit is contained in:
parent
6338bde568
commit
ed199c8d76
@ -81,12 +81,19 @@ template <typename T, size_t N> struct ExceptValues {
|
||||
StorageType out_bits = values[i].rnd_towardzero_result;
|
||||
switch (fputil::quick_get_round()) {
|
||||
case FE_UPWARD:
|
||||
out_bits += sign ? values[i].rnd_downward_offset
|
||||
: values[i].rnd_upward_offset;
|
||||
if (sign)
|
||||
out_bits += values[i].rnd_downward_offset;
|
||||
else
|
||||
out_bits += values[i].rnd_upward_offset;
|
||||
break;
|
||||
case FE_DOWNWARD:
|
||||
out_bits += sign ? values[i].rnd_upward_offset
|
||||
: values[i].rnd_downward_offset;
|
||||
// Use conditionals instead of ternary operator to work around gcc's
|
||||
// -Wconversion false positive bug:
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101537
|
||||
if (sign)
|
||||
out_bits += values[i].rnd_upward_offset;
|
||||
else
|
||||
out_bits += values[i].rnd_downward_offset;
|
||||
break;
|
||||
case FE_TONEAREST:
|
||||
out_bits += values[i].rnd_tonearest_offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user