aboutsummaryrefslogtreecommitdiff
path: root/libclc
diff options
context:
space:
mode:
authorluolent <56246516+luolent@users.noreply.github.com>2024-05-04 20:38:45 +0300
committerGitHub <noreply@github.com>2024-05-04 18:38:45 +0100
commita98a6e95be1be9a5c28da15b4d19a6f39872461d (patch)
tree414af1d920cc1be91c79ff23fded3b4cdf291faa /libclc
parent028f1b078193b9120ddb441808521b6bd6eaed0e (diff)
downloadllvm-a98a6e95be1be9a5c28da15b4d19a6f39872461d.zip
llvm-a98a6e95be1be9a5c28da15b4d19a6f39872461d.tar.gz
llvm-a98a6e95be1be9a5c28da15b4d19a6f39872461d.tar.bz2
Add clarifying parenthesis around non-trivial conditions in ternary expressions. (#90391)
Fixes [#85868](https://github.com/llvm/llvm-project/issues/85868) Parenthesis are added as requested on ternary operators with non trivial conditions. I used this [precedence table](https://en.cppreference.com/w/cpp/language/operator_precedence) for reference, to make sure we get the expected behavior on each change.
Diffstat (limited to 'libclc')
-rw-r--r--libclc/generic/lib/math/log_base.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libclc/generic/lib/math/log_base.h b/libclc/generic/lib/math/log_base.h
index f5b6f1c..2558f01 100644
--- a/libclc/generic/lib/math/log_base.h
+++ b/libclc/generic/lib/math/log_base.h
@@ -289,7 +289,7 @@ log(double x)
double ret = is_near ? ret_near : ret_far;
ret = isinf(x) ? as_double(PINFBITPATT_DP64) : ret;
- ret = isnan(x) | (x < 0.0) ? as_double(QNANBITPATT_DP64) : ret;
+ ret = (isnan(x) | (x < 0.0)) ? as_double(QNANBITPATT_DP64) : ret;
ret = x == 0.0 ? as_double(NINFBITPATT_DP64) : ret;
return ret;
}