[libc-commits] [PATCH] D133134: [libc][NFC] Use cpp::optional for checking exceptional values of math functions.
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Sep 1 14:11:36 PDT 2022
sivachandra accepted this revision.
sivachandra added inline comments.
This revision is now accepted and ready to land.
================
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()))
----------------
lntue wrote:
> 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.
Ah yes! We should do `*r` but thats a nitty nit at this point.
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