mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
src/sfendian.h : Make ENDSWAP_64() work with i686-w64-mingw32 compiler.
This commit is contained in:
parent
3cddd9a889
commit
a53b8479f3
@ -1,7 +1,7 @@
|
||||
2012-02-05 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* src/
|
||||
Refactor chunk storage so it work on big as well as little endian CPUs.
|
||||
Refactor chunk storage so it work on big as well as little endian CPUs.
|
||||
|
||||
* tests/chunk_test.c
|
||||
Clean up error messages.
|
||||
@ -15,6 +15,7 @@
|
||||
* src/sfendian.h
|
||||
Use <x86intrin.h> intrinsics (ie for MinGW) when <byteswap.h> is not
|
||||
present.
|
||||
Make ENDSWAP_64() work with i686-w64-mingw32 compiler.
|
||||
|
||||
* src/ALAC/EndianPortable.c
|
||||
Add support for __powerpc__.
|
||||
|
@ -38,8 +38,9 @@
|
||||
|
||||
#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) + (((x) & 0xFF) << 8))
|
||||
#define ENDSWAP_32(x) (__bswapd (x))
|
||||
#define ENDSWAP_64(x) (_bswap64 (x))
|
||||
|
||||
#if defined (__x86_64__)
|
||||
#define ENDSWAP_64(x) (__bswapq (x))
|
||||
#endif
|
||||
#else
|
||||
|
||||
#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) + (((x) & 0xFF) << 8))
|
||||
@ -47,6 +48,23 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef ENDSWAP_64
|
||||
static inline uint64_t
|
||||
ENDSWAP_64 (uint64_t x)
|
||||
{ union
|
||||
{ uint32_t parts [2] ;
|
||||
uint64_t whole ;
|
||||
} u ;
|
||||
uint32_t temp ;
|
||||
|
||||
u.whole = x ;
|
||||
temp = u.parts [0] ;
|
||||
u.parts [0] = ENDSWAP_32 (u.parts [1]) ;
|
||||
u.parts [1] = ENDSWAP_32 (temp) ;
|
||||
return u.whole ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Many file types (ie WAV, AIFF) use sets of four consecutive bytes as a
|
||||
** marker indicating different sections of the file.
|
||||
|
Loading…
Reference in New Issue
Block a user