Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d087011

Browse files
authored
Merge branch 'develop' into support-gnu-hurd
2 parents 44959b4 + 8fe07ba commit d087011

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.rst

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ version develop
1212
-----------------
1313
+ Use upstream ISA-L version 2.31.1 which includes patches to make
1414
installation possible.
15+
+ Fix a bug where bytes were copied in the wrong order on big endian
16+
architectures. Fixes test failures on s390x.
1517
+ Enable building on GNU/Hurd platforms.
1618

1719
version 1.7.1

src/isal/isal_shared.h

+7
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,15 @@ static int bitbuffer_copy(struct inflate_state *state, char *to, size_t n){
207207
int remainder = bits_in_buffer % 8;
208208
// Shift the 8-byte bitbuffer read_in so that the bytes are aligned.
209209
uint64_t remaining_bytes = state->read_in >> remainder;
210+
#if PY_BIG_ENDIAN
211+
char *remaining_buffer = (char *)&remaining_bytes;
212+
for (int i = 0; i < n; ++i) {
213+
to[i] = remaining_buffer[7-i];
214+
}
215+
#else
210216
// memcpy works because of little-endianness
211217
memcpy(to, &remaining_bytes, n);
218+
#endif
212219
return 0;
213220
}
214221

src/isal/isal_zlibmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ static inline uint32_t load_u32_le(void *address) {
16431643
static inline uint16_t load_u16_le(void *address) {
16441644
#if PY_BIG_ENDIAN
16451645
uint8_t *mem = address;
1646-
return mem[0] | (mem[1] << 8) | (mem[2] << 16) | (mem[3] << 24);
1646+
return mem[0] | (mem[1] << 8);
16471647
#else
16481648
return *(uint16_t *)address;
16491649
#endif

0 commit comments

Comments
 (0)