This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Greetings, This is late but I wanted to put it out there just to finish a thing.It's fairly straightforward constexpr of operators and some simple functions for std::complex.
The only thing that jumped out was the norm function. We had this: struct _Norm_helper<true> { template<typename _Tp> static inline _Tp _S_do_it(const complex<_Tp>& __z) { _Tp __res = std::abs(__z); return __res * __res; } };Since abs can't be made constexpr for complex since it involves sqrt (It probably could but that's another story) I had to fall back to the x^2 + y^2. I don't know who that will bother. This version should be faster and I can't think of any useful trustworthy difference numerically either in terms of accuracy of stability.
Barring any feedback on that I'll clean it up and maybe rename my tests from constexpr_all_the_things.cc to more_constexpr.cc ;-)
It builds and tests cleanly on x86_64-linux. Ed
Attachment:
CL_p0415
Description: Text document
Attachment:
patch_p0415
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |