]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Use __cpu_to_xxx macros for endian conversion
authorTakashi Iwai <tiwai@suse.de>
Wed, 6 Sep 2000 09:25:04 +0000 (09:25 +0000)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 Sep 2000 09:25:04 +0000 (09:25 +0000)
include/conv.h

index 2b271334e23893a091d720da317710062ad29d8e..e7aa8d5271817fd9cd11b6d2b78e11f37c816afe 100644 (file)
@@ -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)