Skip to content

Commit c56c890

Browse files
committed
handle I;16 native endianness on big-endian machine
1 parent 79c9b2b commit c56c890

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/_imaging.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,17 @@ if (PySequence_Check(op)) { \
15781578
int bigendian = 0;
15791579
if (image->type == IMAGING_TYPE_SPECIAL) {
15801580
// I;16*
1581-
bigendian = strcmp(image->mode, "I;16B") == 0;
1581+
if (strcmp(image->mode, "I;16N") == 0) {
1582+
#ifdef WORDS_BIGENDIAN
1583+
bigendian = 1;
1584+
#else
1585+
bigendian = 0;
1586+
#endif
1587+
} else if (strcmp(image->mode, "I;16B") == 0) {
1588+
bigendian = 1;
1589+
} else {
1590+
bigendian = 0;
1591+
}
15821592
}
15831593
for (i = x = y = 0; i < n; i++) {
15841594
set_value_to_item(seq, i);

0 commit comments

Comments
 (0)