mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Use __cpu_to_xxx macros for endian conversion
This commit is contained in:
parent
d1d906e295
commit
0868c7720b
1 changed files with 8 additions and 25 deletions
|
|
@ -5,29 +5,12 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef SND_LITTLE_ENDIAN
|
||||
|
||||
#define snd_host_to_LE_16(val) (val)
|
||||
#define snd_LE_to_host_16(val) (val)
|
||||
#define snd_host_to_LE_32(val) (val)
|
||||
#define snd_LE_to_host_32(val) (val)
|
||||
#define snd_host_to_BE_16(val) ((((val)>>8)&0xff)|(((val)<<8)&0xff00))
|
||||
#define snd_BE_to_host_16(val) snd_host_to_BE_16(val)
|
||||
#define snd_host_to_BE_32(val) ((((val)>>24)&0xff)|(((val)>>16)&0xff00)|\
|
||||
(((val)<<16)&0xff0000)|(((val)<<24)&0xff000000))
|
||||
#define snd_BE_to_host_32(val) snd_host_to_BE_32(val)
|
||||
|
||||
#else
|
||||
|
||||
#define snd_host_to_BE_16(val) (val)
|
||||
#define snd_BE_to_host_16(val) (val)
|
||||
#define snd_host_to_BE_16(val) (val)
|
||||
#define snd_BE_to_host_16(val) (val)
|
||||
#define snd_host_to_LE_16(val) ((((val)>>8)&0xff)|(((val)<<8)&0xff00))
|
||||
#define snd_LE_to_host_16(val) snd_host_to_LE_16(val)
|
||||
#define snd_host_to_LE_32(val) ((((val)>>24)&0xff)|(((val)>>16)&0xff00)|\
|
||||
(((val)<<16)&0xff0000)|(((val)<<24)&0xff000000))
|
||||
#define snd_LE_to_host_32(val) snd_host_to_LE_32(val)
|
||||
|
||||
#endif
|
||||
#define snd_host_to_LE_16(val) __cpu_to_le16(val)
|
||||
#define snd_LE_to_host_16(val) __le16_to_cpu(val)
|
||||
#define snd_host_to_LE_32(val) __cpu_to_le32(val)
|
||||
#define snd_LE_to_host_32(val) __le32_to_cpu(val)
|
||||
#define snd_host_to_BE_16(val) __cpu_to_be16(val)
|
||||
#define snd_BE_to_host_16(val) __be16_to_cpu(val)
|
||||
#define snd_host_to_BE_32(val) __cpu_to_be32(val)
|
||||
#define snd_BE_to_host_32(val) __be32_to_cpu(val)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue