Skip to content

Commit

Permalink
Use gcc native bswap16 when available..
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jul 28, 2014
1 parent 70bff18 commit 199f92c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/bin/wave.c
Expand Up @@ -168,7 +168,11 @@ unsigned char wave_open(const char *fname, wave_t *wave, shine_config_t *config,
}

#ifdef SHINE_BIG_ENDIAN
static inline int16_t bswap_16 (int16_t x) { return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)); }
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
#define bswap_16(x) __builtin_bswap16(x)
#else
#define bswap_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
#endif

void swap_buffer(int16_t *sample_buffer, int length)
{
Expand Down

0 comments on commit 199f92c

Please sign in to comment.