Skip to content

Commit e09e682

Browse files
committed
Use a simpler endianness detection for the OpenSL ES backend
1 parent c5e9464 commit e09e682

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Alc/backends/opensl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device)
297297
format_pcm.channelMask = GetChannelMask(Device->FmtChans);
298298
#ifdef HAVE_OPENSL_1_1
299299
format_pcm.endianness = SL_BYTEORDER_NATIVE;
300-
#elif _BYTE_ORDER == _BIG_ENDIAN
301-
format_pcm.endianness = SL_BYTEORDER_BIGENDIAN;
302300
#else
303-
format_pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
301+
union { unsigned short num; char buf[sizeof(unsigned short)]; } endianness;
302+
endianness.num = 1;
303+
format_pcm.endianness = endianness.buf[0] ? SL_BYTEORDER_LITTLEENDIAN : SL_BYTEORDER_BIGENDIAN;
304304
#endif
305305

306306
audioSrc.pLocator = &loc_bufq;

0 commit comments

Comments
 (0)