Skip to content

Commit

Permalink
Merge pull request #345 from jokva/endianness-with-if-not-ifdef
Browse files Browse the repository at this point in the history
Test endianness in segy.c properly
  • Loading branch information
jokva committed Dec 23, 2018
2 parents 32d8dd1 + f3280e2 commit dbe1772
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 1.8.3
* Check endianness variable properly

# 1.8.2
* Pass HOST_BIG_ENDIAN as preprocessor directive, not compiler option

Expand Down
8 changes: 4 additions & 4 deletions lib/src/segy.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,31 +102,31 @@ static int encode( char* dst,
#endif // __GNUC__

static uint16_t htobe16( uint16_t v ) {
#ifdef HOST_LSB
#if HOST_LSB
return bswap16(v);
#else
return v;
#endif
}

static uint32_t htobe32( uint32_t v ) {
#ifdef HOST_LSB
#if HOST_LSB
return bswap32(v);
#else
return v;
#endif
}

static uint16_t be16toh( uint16_t v ) {
#ifdef HOST_LSB
#if HOST_LSB
return bswap16(v);
#else
return v;
#endif
}

static uint32_t be32toh( uint32_t v ) {
#ifdef HOST_LSB
#if HOST_LSB
return bswap32(v);
#else
return v;
Expand Down

0 comments on commit dbe1772

Please sign in to comment.