summaryrefslogtreecommitdiffstats
path: root/libcxx/include/numeric
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Fix typo in std::midpointRuslan Baratov2019-12-211-1/+1
| | | | | | Reviewed By: mclow.lists Differential Revision: https://reviews.llvm.org/D71525
* Optimize std::midpoint for integersJorg Brown2019-11-041-10/+7
| | | | | | | | | | | | | | Same idea as the current algorithm, that is, add (half of the difference between a and b) to a. But we use a different technique for computing the difference: we compute b - a into a pair of integers that are named "sign_bit" and "diff". We have to use a pair because subtracting two 32-bit integers produces a 33-bit result. Computing half of that is a simple matter of shifting diff right by 1, and adding sign_bit shifted left by 31. llvm knows how to do that with one instruction: shld. The only tricky part is that if the difference is odd and negative, then shifting it by one isn't the same as dividing it by two - shifting a negative one produces a negative one, for example. So there's one more adjustment: if the sign bit and the low bit of diff are one, we add one. For a demonstration of the codegen difference, see https://godbolt.org/z/7ar3K9 , which also has a built-in test. Differential Revision: https://reviews.llvm.org/D69459
* [pstl][libc++] Provide uglified header names for interface headersLouis Dionne2019-08-061-1/+1
| | | | | | | | | | | For the few (currently four) headers that make up the PSTL's interface to other Standard Libraries, provide a stable uglified header file that can be included by those Standard Libraries. We can then more easily change the internal organization of the PSTL without having to change the integration with Standard Libraries. llvm-svn: 368088
* [libc++] Take 2: Integrate the PSTL into libc++Louis Dionne2019-08-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. The first attempt to commit this failed because it exposed a bug in the tests for modules. Now that this has been fixed, it should be safe to commit this. Reviewers: EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 367903
* Revert "[libc++] Integrate the PSTL into libc++"Louis Dionne2019-07-191-4/+0
| | | | | | | This reverts r366593, which caused unforeseen breakage on the build bots. I'm reverting until the problems have been figured out and fixed. llvm-svn: 366603
* [libc++] Integrate the PSTL into libc++Louis Dionne2019-07-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. Reviewers: rodgert, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 366593
* Fix the floating point version of midpoint. It wasn't constexpr, among other ↵Marshall Clow2019-06-181-11/+18
| | | | | | things. Add more tests. As a drive-by, the LCD implementation had a class named '__abs' which did a 'absolute value to a common-type' conversion. Rename that to be '__ct_abs'. llvm-svn: 363714
* [NFC][libcxx] Remove trailing whitespaceLouis Dionne2019-05-291-4/+4
| | | | | | It's incredibly annoying when trying to create diffs llvm-svn: 361981
* Add additional constraints on midpoint(pointer, pointer). Fixes PR#42037.Marshall Clow2019-05-291-2/+5
| | | | llvm-svn: 361970
* Mark private function __sign as constexpr.Marshall Clow2019-05-071-1/+1
| | | | llvm-svn: 360167
* Implement midpoint for floating point types. Reviewed as ↵Marshall Clow2019-04-251-1/+19
| | | | | | https://reviews.llvm.org/D61014. llvm-svn: 359184
* Add std::midpoint for integral and poiner types. Described in P0811, ↵Marshall Clow2019-03-141-0/+35
| | | | | | reviewed as D59099. llvm-svn: 356162
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* [NFC][libc++] Consistently use spaces to indentLouis Dionne2018-08-031-4/+4
| | | | | | rdar://problem/19988944 llvm-svn: 338933
* Fix incorrect handling of move-only types in transform_reduce iter iter iter ↵Billy Robert O'Neal III2018-01-051-1/+1
| | | | | | init, and add test. llvm-svn: 321851
* Automated trailing whitespace removal by VS Code.Billy Robert O'Neal III2018-01-051-18/+18
| | | | llvm-svn: 321850
* Implement inclusive_scan/transform_inclusive_scan for C++17.Marshall Clow2017-06-231-0/+87
| | | | llvm-svn: 306083
* Implement the non-parallel versions of reduce and transform_reduce for C++17Marshall Clow2017-06-141-0/+93
| | | | llvm-svn: 305365
* Implement the non-parallel versions of exclusive_scan and ↵Marshall Clow2017-06-101-0/+71
| | | | | | transform_exclusive_scan. Reviewed as https://reviews.llvm.org/D34038. llvm-svn: 305136
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-0/+5
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Fix GCC 7 test failures.Eric Fiselier2017-05-091-5/+6
| | | | | | | | | | | This patch fixes the test failures and unexpected passes that occur when testing against GCC 7. Specifically: * don't mark __gcd as always inline because it's a recursive function. GCC diagnoses this. * don't XFAIL the aligned allocation tests. GCC 7 supports them but not the -faligned-allocation option. * Work around gcc.gnu.org/PR78489 in variants constructors. llvm-svn: 302488
* Make lcm/gcd work better in edge cases. Fixes a UBSAN failure.Marshall Clow2017-02-101-12/+17
| | | | llvm-svn: 294779
* Add missing include in <numeric>Eric Fiselier2017-02-081-0/+1
| | | | llvm-svn: 294393
* Fixes for LWG 2598, 2686, 2739, 2742, 2747, and 2759, which were adopted ↵Marshall Clow2016-11-141-0/+4
| | | | | | last week in Issaquah llvm-svn: 286858
* Implement LCM and GCD for C++17. Same code as for Library Fundamentals TS.Marshall Clow2016-07-261-0/+62
| | | | llvm-svn: 276751
* [libcxx] Fix use of operator comma where the types can be user definedEric Fiselier2014-10-271-7/+7
| | | | | | | | | | | | | | | | Summary: An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected. Modify all the test iterators to define operator comma. Reviewers: danalbert, mclow.lists Reviewed By: mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5929 llvm-svn: 220706
* Zhihao Yuan noted that a move assignment operation was missing from ↵Howard Hinnant2013-08-221-2/+2
| | | | | | std::adjacent_difference. Fixed. llvm-svn: 189036
* More windows port work by Ruben Van BoxemHoward Hinnant2011-10-221-3/+3
| | | | llvm-svn: 142732
* Windows support by Ruben Van Boxem.Howard Hinnant2011-10-171-0/+2
| | | | llvm-svn: 142235
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* [numeric.iota]Howard Hinnant2010-05-261-0/+12
| | | | llvm-svn: 104719
* Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant2010-05-111-1/+1
| | | | llvm-svn: 103516
* libcxx initial importHoward Hinnant2010-05-111-0/+183
llvm-svn: 103490
OpenPOWER on IntegriCloud