1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sat, 1 Jul 2023 10:54:41 +0200
Subject: Handle architecture-dependent signedness of char and wchar_t
Forwarded: https://github.com/stotko/stdgpu/pull/454
---
src/stdgpu/limits.h | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/stdgpu/limits.h b/src/stdgpu/limits.h
index 9276d2d..8ba777c 100644
--- a/src/stdgpu/limits.h
+++ b/src/stdgpu/limits.h
@@ -253,7 +253,7 @@ struct numeric_limits<char>
* \brief Whether the type is signed
* \note implementation-defined
*/
- static constexpr bool is_signed = true;
+ static constexpr bool is_signed = ((char)(-1) < 0);
/**
* \brief Whether the type is an integer
@@ -490,16 +490,10 @@ struct numeric_limits<wchar_t>
*/
static constexpr bool is_specialized = true;
-/**
- * \var is_signed
- * \brief Whether the type is signed
- * \note implementation-defined
- */
-#if STDGPU_HOST_COMPILER == STDGPU_HOST_COMPILER_MSVC
- static constexpr bool is_signed = false;
-#else
- static constexpr bool is_signed = true;
-#endif
+ /**
+ * \brief Whether the type is signed
+ */
+ static constexpr bool is_signed = ((wchar_t)(-1) < 0);
/**
* \brief Whether the type is an integer
|