diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index 232773af..81530277 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -354,7 +354,7 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from ) /* We need to swap for other fields if the file byte order is * different from ours. */ - swap = vips_amiMSBfirst() != (im->magic == VIPS_MAGIC_SPARC); + swap = vips_amiMSBfirst() != vips_image_isMSBfirst( im ); for( i = 0; i < VIPS_NUMBER( fields ); i++ ) { fields[i].copy( swap, @@ -435,7 +435,7 @@ vips__write_header_bytes( VipsImage *im, unsigned char *to ) /* Swap if the byte order we are asked to write the header in is * different from ours. */ - gboolean swap = vips_amiMSBfirst() != (im->magic == VIPS_MAGIC_SPARC); + gboolean swap = vips_amiMSBfirst() != vips_image_isMSBfirst( im ); int i; unsigned char *q;