git: 006829bcdc99 - main - math/primecount: fix build on big-endian
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Dec 2021 22:32:38 UTC
The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=006829bcdc99fde7f9281eb9fb9c680ff986467c commit 006829bcdc99fde7f9281eb9fb9c680ff986467c Author: Piotr Kubaj <pkubaj@FreeBSD.org> AuthorDate: 2021-12-23 22:25:49 +0000 Commit: Piotr Kubaj <pkubaj@FreeBSD.org> CommitDate: 2021-12-23 22:25:49 +0000 math/primecount: fix build on big-endian /usr/bin/c++ -DENABLE_DIV32 -Dlibprimecount_EXPORTS -I/wrkdirs/usr/ports/math/primecount/work/primecount-7.2/include -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -MD -MT CMakeFiles/libprimecount.dir/src/Sieve.cpp.o -MF CMakeFiles/libprimecount.dir/src/Sieve.cpp.o.d -o CMakeFiles/libprimecount.dir/src/Sieve.cpp.o -c /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/src/Sieve.cpp In file included from /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/src/Sieve.cpp:38: /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/include/SieveTables.hpp:63:40: error: too many arguments provided to function-like macro invocation constexpr uint64_t bswap64(uint64_t i, uint64_t j = 0, uint64_t n = 0) ^ /usr/include/sys/endian.h:63:9: note: macro 'bswap64' defined here ^ In file included from /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/src/Sieve.cpp:38: /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/include/SieveTables.hpp:65:3: error: expected expression return (n == sizeof(uint64_t)) ? j : ^ /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/include/SieveTables.hpp:66:21: error: too many arguments provided to function-like macro invocation bswap64(i >> 8, (j << 8) | (i & 0xff), n + 1); ^ /usr/include/sys/endian.h:63:9: note: macro 'bswap64' defined here ^ In file included from /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/src/Sieve.cpp:38: /wrkdirs/usr/ports/math/primecount/work/primecount-7.2/include/SieveTables.hpp:67:2: error: expected ';' after top level declarator } ^ ; 4 errors generated. --- .../primecount/files/patch-include_SieveTables.hpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/math/primecount/files/patch-include_SieveTables.hpp b/math/primecount/files/patch-include_SieveTables.hpp new file mode 100644 index 000000000000..4dd773f4b179 --- /dev/null +++ b/math/primecount/files/patch-include_SieveTables.hpp @@ -0,0 +1,29 @@ +--- include/SieveTables.hpp.orig 2021-12-20 20:37:55 UTC ++++ include/SieveTables.hpp +@@ -60,22 +60,22 @@ constexpr int right_shift(int n) + /// on big endian CPU architectures. + + /// Reverse byte order of 64-bit integer +-constexpr uint64_t bswap64(uint64_t i, uint64_t j = 0, uint64_t n = 0) ++constexpr uint64_t bswap_64(uint64_t i, uint64_t j = 0, uint64_t n = 0) + { + return (n == sizeof(uint64_t)) ? j : +- bswap64(i >> 8, (j << 8) | (i & 0xff), n + 1); ++ bswap_64(i >> 8, (j << 8) | (i & 0xff), n + 1); + } + + /// Bitmask to unset bits <= n + constexpr uint64_t unset_s(int n) + { +- return bswap64(~0ull << left_shift(n)); ++ return bswap_64(~0ull << left_shift(n)); + } + + /// Bitmask to unset bits >= n + constexpr uint64_t unset_l(int n) + { +- return bswap64((n == 0) ? 0 : ~0ull >> right_shift(n)); ++ return bswap_64((n == 0) ? 0 : ~0ull >> right_shift(n)); + } + + #else