summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2021-09-05 19:36:30 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2021-09-05 19:40:19 +0300
commit3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478 (patch)
tree0d877ce7917f52a174dd2e4d48dddf50cd3b6424 /dev-libs/crc32c
parentdev-libs/crc32c: move to cmake.eclass, fix Werror (diff)
downloadgentoo-3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478.tar.gz
gentoo-3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478.tar.bz2
gentoo-3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478.zip
dev-libs/crc32c: fix for big endian systems
Closes: https://bugs.gentoo.org/810688 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-libs/crc32c')
-rw-r--r--dev-libs/crc32c/crc32c-1.0.6-r1.ebuild (renamed from dev-libs/crc32c/crc32c-1.0.6.ebuild)4
-rw-r--r--dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch29
2 files changed, 33 insertions, 0 deletions
diff --git a/dev-libs/crc32c/crc32c-1.0.6.ebuild b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild
index baf1e8683e97..53b6e710e340 100644
--- a/dev-libs/crc32c/crc32c-1.0.6.ebuild
+++ b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild
@@ -13,6 +13,10 @@ LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 ~riscv x86"
+PATCHES=(
+ "${FILESDIR}/${P}-fix-big-endian.patch"
+)
+
DOCS=( README.md )
src_prepare() {
diff --git a/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch b/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch
new file mode 100644
index 000000000000..3bd09930946a
--- /dev/null
+++ b/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch
@@ -0,0 +1,29 @@
+From: Pieter Wuille <github-sipa@wuille.net>
+Date: Thu, 18 Jun 2020 21:05:38 -0700
+Subject: [PATCH] Fix (unused) ReadUint64LE for BE machines (#41)
+
+--- a/src/crc32c_read_le.h
++++ b/src/crc32c_read_le.h
+@@ -30,14 +30,14 @@ inline uint32_t ReadUint32LE(const uint8_t* buffer) {
+ // Reads a little-endian 64-bit integer from a 64-bit-aligned buffer.
+ inline uint64_t ReadUint64LE(const uint8_t* buffer) {
+ #if BYTE_ORDER_BIG_ENDIAN
+- return ((static_cast<uint32_t>(static_cast<uint8_t>(buffer[0]))) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[1])) << 8) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[2])) << 16) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[3])) << 24) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[4])) << 32) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[5])) << 40) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[6])) << 48) |
+- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[7])) << 56));
++ return ((static_cast<uint64_t>(static_cast<uint8_t>(buffer[0]))) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[1])) << 8) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[2])) << 16) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[3])) << 24) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[4])) << 32) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[5])) << 40) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[6])) << 48) |
++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[7])) << 56));
+ #else // !BYTE_ORDER_BIG_ENDIAN
+ uint64_t result;
+ // This should be optimized to a single instruction.