aboutsummaryrefslogtreecommitdiff
path: root/libcxx/modules/std/numeric.inc
diff options
context:
space:
mode:
authorHristo Hristov <hristo.goshev.hristov@gmail.com>2024-01-22 06:57:45 +0200
committerGitHub <noreply@github.com>2024-01-22 06:57:45 +0200
commit03c19e91e8d8cb706b58e02d69f80caeaf7eb0f4 (patch)
treee4b1ffdf5ce979e79ab1f002651289afdf048a7f /libcxx/modules/std/numeric.inc
parent85337df9e36a10941faa14472b1a4ea0607bfced (diff)
downloadllvm-03c19e91e8d8cb706b58e02d69f80caeaf7eb0f4.zip
llvm-03c19e91e8d8cb706b58e02d69f80caeaf7eb0f4.tar.gz
llvm-03c19e91e8d8cb706b58e02d69f80caeaf7eb0f4.tar.bz2
[libc++][numeric] P0543R3: Saturation arithmetic (#77967)
Implements: https://wg21.link/P0543R3 - https://eel.is/c++draft/numeric.sat Additional references: - Division: https://eel.is/c++draft/expr.mul#4 - Arithmetic conversions: https://eel.is/c++draft/expr.arith.conv#1 - Clang builtins: https://clang.llvm.org/docs/LanguageExtensions.html#builtin-functions Depends on: https://github.com/llvm/llvm-project/pull/78086 --------- Co-authored-by: Zingam <zingam@outlook.com> Co-authored-by: Mark de Wever <zar-rpg@xs4all.nl>
Diffstat (limited to 'libcxx/modules/std/numeric.inc')
-rw-r--r--libcxx/modules/std/numeric.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/libcxx/modules/std/numeric.inc b/libcxx/modules/std/numeric.inc
index d2b7688..3bc7b23 100644
--- a/libcxx/modules/std/numeric.inc
+++ b/libcxx/modules/std/numeric.inc
@@ -54,4 +54,14 @@ export namespace std {
// [numeric.ops.midpoint], midpoint
using std::midpoint;
+
+#if _LIBCPP_STD_VER >= 26
+ // [numeric.sat], saturation arithmetic
+ using std::add_sat;
+ using std::div_sat;
+ using std::mul_sat;
+ using std::saturate_cast;
+ using std::sub_sat;
+#endif
+
} // namespace std