Skip to content

Commit 82970e1

Browse files
committed
fix comment and format
1 parent e032bfd commit 82970e1

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

flang/lib/Evaluate/intrinsics-library.cpp

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -336,27 +336,26 @@ template <typename T, typename TA> static std::complex<T> CToCpp(const TA &x) {
336336
using FTypeCmplxFlt = _Complex float (*)(_Complex float);
337337
using FTypeCmplxDble = _Complex double (*)(_Complex double);
338338
template <typename T>
339-
using FTypeStdCmplx = std::complex<T> (*)(const std::complex<T>&);
339+
using FTypeStdCmplx = std::complex<T> (*)(const std::complex<T> &);
340340

341341
std::map<trigFunc, std::tuple<FTypeCmplxFlt, FTypeCmplxDble>> mapLibmTrigFunc{
342342
{Cacos, {&cacosf, &cacos}}, {Cacosh, {&cacoshf, &cacosh}},
343343
{Casin, {&casinf, &casin}}, {Casinh, {&casinhf, &casinh}},
344344
{Catan, {&catanf, &catan}}, {Catanh, {&catanhf, &catanh}},
345345
{Ccos, {&ccosf, &ccos}}, {Ccosh, {&ccoshf, &ccosh}},
346-
{Cexp, {&cexpf, &cexp}}, {Clog, {&clogf, &__clog}},
347-
{Csin, {&csinf, &csin}}, {Csinh, {&csinhf, &csinh}},
348-
{Csqrt, {&csqrtf, &csqrt}}, {Ctan, {&ctanf, &ctan}},
349-
{Ctanh, {&ctanhf, &ctanh}}};
346+
{Cexp, {&cexpf, &cexp}}, {Clog, {&clogf, &__clog}}, {Csin, {&csinf, &csin}},
347+
{Csinh, {&csinhf, &csinh}}, {Csqrt, {&csqrtf, &csqrt}},
348+
{Ctan, {&ctanf, &ctan}}, {Ctanh, {&ctanhf, &ctanh}}};
350349

351350
template <trigFunc TF, typename HostT>
352351
std::complex<HostT> LibmTrigFunc(const std::complex<HostT> &x) {
353352
if constexpr (std::is_same_v<HostT, float>) {
354-
float _Complex r{
355-
std::get<FTypeCmplxFlt>(mapLibmTrigFunc[TF])(CppToC<float _Complex, float>(x))};
353+
float _Complex r{std::get<FTypeCmplxFlt>(mapLibmTrigFunc[TF])(
354+
CppToC<float _Complex, float>(x))};
356355
return CToCpp<float, float _Complex>(r);
357356
} else if constexpr (std::is_same_v<HostT, double>) {
358-
double _Complex r{
359-
std::get<FTypeCmplxDble>(mapLibmTrigFunc[TF])(CppToC<double _Complex, double>(x))};
357+
double _Complex r{std::get<FTypeCmplxDble>(mapLibmTrigFunc[TF])(
358+
CppToC<double _Complex, double>(x))};
360359
return CToCpp<double, double _Complex>(r);
361360
}
362361
DIE("bad complex component type");
@@ -404,7 +403,7 @@ template <trigFunc TF> struct X {
404403
static std::complex<HostT> f(const std::complex<HostT> &x) {
405404
std::complex<HostT> res;
406405
#ifdef _AIX
407-
// On AIX, the implementation in libm is different from that of std::
406+
// On AIX, the implementation in libm is different from that of the STL
408407
// routines, use the libm routines here in folding for consistent results.
409408
res = LibmTrigFunc<TF>(x);
410409
#else
@@ -417,16 +416,16 @@ template <trigFunc TF> struct X {
417416
// Helpers to map complex std::pow whose resolution in F2{std::pow} is
418417
// ambiguous as of clang++ 20.
419418
template <typename HostT>
420-
static std::complex<HostT> StdPowF2(const std::complex<HostT> &x,
421-
const std::complex<HostT> &y) {
419+
static std::complex<HostT> StdPowF2(
420+
const std::complex<HostT> &x, const std::complex<HostT> &y) {
422421
#ifdef _AIX
423422
if constexpr (std::is_same_v<HostT, float>) {
424-
float _Complex r{cpowf(CppToC<float _Complex, float>(x),
425-
CppToC<float _Complex, float>(y))};
423+
float _Complex r{cpowf(
424+
CppToC<float _Complex, float>(x), CppToC<float _Complex, float>(y))};
426425
return CToCpp<float, float _Complex>(r);
427426
} else if constexpr (std::is_same_v<HostT, double>) {
428427
double _Complex r{cpow(CppToC<double _Complex, double>(x),
429-
CppToC<double _Complex, double>(y))};
428+
CppToC<double _Complex, double>(y))};
430429
return CToCpp<double, double _Complex>(r);
431430
}
432431
#else
@@ -435,18 +434,18 @@ static std::complex<HostT> StdPowF2(const std::complex<HostT> &x,
435434
}
436435

437436
template <typename HostT>
438-
static std::complex<HostT> StdPowF2A(const HostT &x,
439-
const std::complex<HostT> &y) {
437+
static std::complex<HostT> StdPowF2A(
438+
const HostT &x, const std::complex<HostT> &y) {
440439
#ifdef _AIX
441440
constexpr HostT zero{0.0};
442441
std::complex<HostT> z(x, zero);
443442
if constexpr (std::is_same_v<HostT, float>) {
444-
float _Complex r{cpowf(CppToC<float _Complex, float>(z),
445-
CppToC<float _Complex, float>(y))};
443+
float _Complex r{cpowf(
444+
CppToC<float _Complex, float>(z), CppToC<float _Complex, float>(y))};
446445
return CToCpp<float, float _Complex>(r);
447446
} else if constexpr (std::is_same_v<HostT, double>) {
448447
double _Complex r{cpow(CppToC<double _Complex, double>(z),
449-
CppToC<double _Complex, double>(y))};
448+
CppToC<double _Complex, double>(y))};
450449
return CToCpp<double, double _Complex>(r);
451450
}
452451
#else
@@ -455,18 +454,18 @@ static std::complex<HostT> StdPowF2A(const HostT &x,
455454
}
456455

457456
template <typename HostT>
458-
static std::complex<HostT> StdPowF2B(const std::complex<HostT> &x,
459-
const HostT &y) {
457+
static std::complex<HostT> StdPowF2B(
458+
const std::complex<HostT> &x, const HostT &y) {
460459
#ifdef _AIX
461460
constexpr HostT zero{0.0};
462461
std::complex<HostT> z(y, zero);
463462
if constexpr (std::is_same_v<HostT, float>) {
464-
float _Complex r{cpowf(CppToC<float _Complex, float>(x),
465-
CppToC<float _Complex, float>(z))};
463+
float _Complex r{cpowf(
464+
CppToC<float _Complex, float>(x), CppToC<float _Complex, float>(z))};
466465
return CToCpp<float, float _Complex>(r);
467466
} else if constexpr (std::is_same_v<HostT, double>) {
468467
double _Complex r{cpow(CppToC<double _Complex, double>(x),
469-
CppToC<double _Complex, double>(z))};
468+
CppToC<double _Complex, double>(z))};
470469
return CToCpp<double, double _Complex>(r);
471470
}
472471
#else

0 commit comments

Comments
 (0)