[libc-commits] [PATCH] D133134: [libc][NFC] Use cpp::optional for checking exceptional values of math functions.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Sep 1 13:51:27 PDT 2022


lntue marked an inline comment as done.
lntue added inline comments.


================
Comment at: libc/src/math/generic/cosf.cpp:114
+  if (auto r =
+          fputil::check_except_values<float, N_EXCEPTS>(COSF_EXCEPTS, x_abs);
+      unlikely(r.has_value()))
----------------
sivachandra wrote:
> Patterns like this should get simplified to:
> 
> ```
> if (auto r = COSF_EXCEPTS.lookup(x_abs); unlikely(r))
>   return r;
> ```
I tried it but our current implementation of `cpp::optional` has no implicit conversion to `T` and the conversion to `bool` is explicit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133134/new/

https://reviews.llvm.org/D133134



More information about the libc-commits mailing list