diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-15 12:41:08 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-10-15 12:41:08 (GMT) |
commit | 213338f26f6d250d5acd2c25037f8bd7462be997 (patch) | |
tree | 2d1c594bdf718171b27d753c9f1bde14aedb16df /src | |
parent | 004217257ab666cff30da8ee9f36f051180f89c0 (diff) |
Change char to unsigned char to do proper comparisons.
Added temporary print statement to debug failed test case.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index d614840..95b0aa4 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -7906,20 +7906,20 @@ tng_function_status DECLSPECDLLEXPORT tng_trajectory_init(tng_trajectory_t *tng_ /* Check the endianness of the computer */ static int32_t endianness_32 = 0x01234567; /* 0x01234567 */ - if ( *(const char*)&endianness_32 == 0x01 ) + if ( *(const unsigned char*)&endianness_32 == 0x01 ) { tng_data->endianness_32 = TNG_BIG_ENDIAN_32; } /* 0x67452301 */ - else if( *(const char*)&endianness_32 == 0x67 ) + else if( *(const unsigned char*)&endianness_32 == 0x67 ) { tng_data->endianness_32 = TNG_LITTLE_ENDIAN_32; } /* 0x45670123 */ - else if ( *(const char*)&endianness_32 == 0x45 ) + else if ( *(const unsigned char*)&endianness_32 == 0x45 ) { tng_data->endianness_32 = TNG_BYTE_PAIR_SWAP_32; } @@ -7927,31 +7927,31 @@ tng_function_status DECLSPECDLLEXPORT tng_trajectory_init(tng_trajectory_t *tng_ { static int64_t endianness_64 = 0x0123456789ABCDEFLL; /* 0x0123456789ABCDEF */ - if ( *(const char*)&endianness_64 == 0x01 ) + if ( *(const unsigned char*)&endianness_64 == 0x01 ) { tng_data->endianness_64 = TNG_BIG_ENDIAN_64; } /* 0xEFCDAB8967452301 */ - else if ( *(const char*)&endianness_64 == 0xEF ) + else if ( *(const unsigned char*)&endianness_64 == 0xEF ) { tng_data->endianness_64 = TNG_LITTLE_ENDIAN_64; } /* 0x89ABCDEF01234567 */ - else if ( *(const char*)&endianness_64 == 0x89 ) + else if ( *(const unsigned char*)&endianness_64 == 0x89 ) { tng_data->endianness_64 = TNG_QUAD_SWAP_64; } /* 0x45670123CDEF89AB */ - else if ( *(const char*)&endianness_64 == 0x45 ) + else if ( *(const unsigned char*)&endianness_64 == 0x45 ) { tng_data->endianness_64 = TNG_BYTE_PAIR_SWAP_64; } /* 0x23016745AB89EFCD */ - else if ( *(const char*)&endianness_64 == 0x23 ) + else if ( *(const unsigned char*)&endianness_64 == 0x23 ) { tng_data->endianness_64 = TNG_BYTE_SWAP_64; } @@ -14197,6 +14197,8 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_write p_data = &tng_data->non_tr_particle_data[tng_data-> n_particle_data_blocks - 1]; } + printf("TEST: %"PRId64" frames, %"PRId64" particles, %"PRId64" values per frame\n", + n_frames, n_particles, n_values_per_frame); stat = tng_allocate_particle_data_mem(tng_data, p_data, n_frames, stride_length, n_particles, n_values_per_frame); |