Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
matio
mat4_bigendian.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mat4_bigendian.patch of Package matio
diff --git a/src/mat4.c b/src/mat4.c index bf2aaae..b1d7194 100644 --- a/src/mat4.c +++ b/src/mat4.c @@ -193,6 +193,10 @@ Mat_VarReadNextInfo4(mat_t *mat) long nBytes; size_t err; matvar_t *matvar = NULL; + union { + mat_uint32_t u; + mat_uint8_t c[4]; + } endian; if ( mat == NULL || mat->fp == NULL ) return NULL; @@ -208,6 +212,8 @@ Mat_VarReadNextInfo4(mat_t *mat) return NULL; } + endian.u = 0x01020304; + /* See if MOPT may need byteswapping */ if ( tmp < 0 || tmp > 4052 ) { if ( Mat_int32Swap(&tmp) > 4052 ) { @@ -224,7 +230,16 @@ Mat_VarReadNextInfo4(mat_t *mat) tmp -= data_type*10; class_type = floor(tmp); - mat->byteswap = (M == 1) ? 1 : 0; + switch ( M ) { + case 0: + /* IEEE little endian */ + mat->byteswap = (endian.c[0] != 4); + break; + case 1: + /* IEEE big endian */ + mat->byteswap = (endian.c[0] != 1); + break; + } /* Convert the V4 data type */ switch ( data_type ) { case 0:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor