Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/crc32c/, dev-libs/crc32c/files/
Date: Sun, 05 Sep 2021 16:41:26
Message-Id: 1630860019.3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478.arthurzam@gentoo
1 commit: 3c7d0c1fc96b5b4dd4ad858e4a27a0d06c823478
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 5 16:36:30 2021 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 5 16:40:19 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c7d0c1f
7
8 dev-libs/crc32c: fix for big endian systems
9
10 Closes: https://bugs.gentoo.org/810688
11 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
12
13 ...{crc32c-1.0.6.ebuild => crc32c-1.0.6-r1.ebuild} | 4 +++
14 .../crc32c/files/crc32c-1.0.6-fix-big-endian.patch | 29 ++++++++++++++++++++++
15 2 files changed, 33 insertions(+)
16
17 diff --git a/dev-libs/crc32c/crc32c-1.0.6.ebuild b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild
18 similarity index 92%
19 rename from dev-libs/crc32c/crc32c-1.0.6.ebuild
20 rename to dev-libs/crc32c/crc32c-1.0.6-r1.ebuild
21 index baf1e8683e9..53b6e710e34 100644
22 --- a/dev-libs/crc32c/crc32c-1.0.6.ebuild
23 +++ b/dev-libs/crc32c/crc32c-1.0.6-r1.ebuild
24 @@ -13,6 +13,10 @@ LICENSE="BSD"
25 SLOT="0"
26 KEYWORDS="amd64 ~riscv x86"
27
28 +PATCHES=(
29 + "${FILESDIR}/${P}-fix-big-endian.patch"
30 +)
31 +
32 DOCS=( README.md )
33
34 src_prepare() {
35
36 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
37 new file mode 100644
38 index 00000000000..3bd09930946
39 --- /dev/null
40 +++ b/dev-libs/crc32c/files/crc32c-1.0.6-fix-big-endian.patch
41 @@ -0,0 +1,29 @@
42 +From: Pieter Wuille <github-sipa@××××××.net>
43 +Date: Thu, 18 Jun 2020 21:05:38 -0700
44 +Subject: [PATCH] Fix (unused) ReadUint64LE for BE machines (#41)
45 +
46 +--- a/src/crc32c_read_le.h
47 ++++ b/src/crc32c_read_le.h
48 +@@ -30,14 +30,14 @@ inline uint32_t ReadUint32LE(const uint8_t* buffer) {
49 + // Reads a little-endian 64-bit integer from a 64-bit-aligned buffer.
50 + inline uint64_t ReadUint64LE(const uint8_t* buffer) {
51 + #if BYTE_ORDER_BIG_ENDIAN
52 +- return ((static_cast<uint32_t>(static_cast<uint8_t>(buffer[0]))) |
53 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[1])) << 8) |
54 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[2])) << 16) |
55 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[3])) << 24) |
56 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[4])) << 32) |
57 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[5])) << 40) |
58 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[6])) << 48) |
59 +- (static_cast<uint32_t>(static_cast<uint8_t>(buffer[7])) << 56));
60 ++ return ((static_cast<uint64_t>(static_cast<uint8_t>(buffer[0]))) |
61 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[1])) << 8) |
62 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[2])) << 16) |
63 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[3])) << 24) |
64 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[4])) << 32) |
65 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[5])) << 40) |
66 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[6])) << 48) |
67 ++ (static_cast<uint64_t>(static_cast<uint8_t>(buffer[7])) << 56));
68 + #else // !BYTE_ORDER_BIG_ENDIAN
69 + uint64_t result;
70 + // This should be optimized to a single instruction.