-
Notifications
You must be signed in to change notification settings - Fork 727
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
devel/quickcpplib: fix on 32 bit platforms
128 bit integers are only supported on 64 bit platforms. Test for them using the correct feature test macro to enable the port there. Approved by: portmgr (build fix blanket) MFH: 2023Q4 See also: ned14/quickcpplib#50
- Loading branch information
1 parent
8266a26
commit 7e25442
Showing
2 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
devel/quickcpplib/files/patch-include_quickcpplib_uint128.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- include/quickcpplib/uint128.hpp.orig 2023-10-24 05:06:15 UTC | ||
+++ include/quickcpplib/uint128.hpp | ||
@@ -53,7 +53,7 @@ namespace integers128 | ||
#if defined(__SSE2__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) | ||
__m128i as_m128i; | ||
#endif | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
unsigned __int128 as_uint128; | ||
#endif | ||
//! Default constructor, no bits set | ||
@@ -100,7 +100,7 @@ namespace integers128 | ||
} | ||
uint128 operator+=(const uint128 &v) noexcept | ||
{ | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 += v.as_uint128; | ||
return *this; | ||
#endif | ||
@@ -118,7 +118,7 @@ namespace integers128 | ||
} | ||
uint128 operator-=(const uint128 &v) noexcept | ||
{ | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 -= v.as_uint128; | ||
return *this; | ||
#endif | ||
@@ -146,7 +146,7 @@ namespace integers128 | ||
{ | ||
if(!b) | ||
throw std::domain_error("divide by zero"); | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 %= b.as_uint128; | ||
return *this; | ||
#endif | ||
@@ -169,7 +169,7 @@ namespace integers128 | ||
{ | ||
if(!b) | ||
throw std::domain_error("divide by zero"); | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 %= b; | ||
return *this; | ||
#endif | ||
@@ -215,7 +215,7 @@ namespace integers128 | ||
} | ||
uint128 operator<<=(uint8_t v) noexcept | ||
{ | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 <<= v; | ||
return *this; | ||
#endif | ||
@@ -232,7 +232,7 @@ namespace integers128 | ||
} | ||
uint128 operator>>=(uint8_t v) noexcept | ||
{ | ||
-#if defined(__GNUC__) || defined(__clang__) | ||
+#if defined(__SIZEOF_INT128__) | ||
as_uint128 >>= v; | ||
return *this; | ||
#endif |