Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ version develop
-----------------
+ Use upstream ISA-L version 2.31.1 which includes patches to make
installation possible.
+ Fix a bug where bytes were copied in the wrong order on big endian
architectures. Fixes test failures on s390x.

version 1.7.1
-----------------
Expand Down
7 changes: 7 additions & 0 deletions src/isal/isal_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,15 @@ static int bitbuffer_copy(struct inflate_state *state, char *to, size_t n){
int remainder = bits_in_buffer % 8;
// Shift the 8-byte bitbuffer read_in so that the bytes are aligned.
uint64_t remaining_bytes = state->read_in >> remainder;
#if PY_BIG_ENDIAN
char *remaining_buffer = (char *)&remaining_bytes;
for (int i = 0; i < n; ++i) {
to[i] = remaining_buffer[7-i];
}
#else
// memcpy works because of little-endianness
memcpy(to, &remaining_bytes, n);
#endif
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/isal/isal_zlibmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ static inline uint32_t load_u32_le(void *address) {
static inline uint16_t load_u16_le(void *address) {
#if PY_BIG_ENDIAN
uint8_t *mem = address;
return mem[0] | (mem[1] << 8) | (mem[2] << 16) | (mem[3] << 24);
return mem[0] | (mem[1] << 8);
#else
return *(uint16_t *)address;
#endif
Expand Down
Loading