summaryrefslogtreecommitdiff
path: root/src/sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/sound.c b/src/sound.c
index 27e06b8abab..f8c6b483056 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -55,6 +55,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* BEGIN: Non Windows Includes */
#ifndef WINDOWSNT
+#include <byteswap.h>
+
#include <sys/ioctl.h>
/* FreeBSD has machine/soundcard.h. Voxware sound driver docs mention
@@ -461,8 +463,7 @@ static u_int32_t
le2hl (u_int32_t value)
{
#ifdef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[0] + (p[1] << 8) + (p[2] << 16) + (p[3] << 24);
+ value = bswap_32 (value);
#endif
return value;
}
@@ -475,8 +476,7 @@ static u_int16_t
le2hs (u_int16_t value)
{
#ifdef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[0] + (p[1] << 8);
+ value = bswap_16 (value);
#endif
return value;
}
@@ -489,30 +489,11 @@ static u_int32_t
be2hl (u_int32_t value)
{
#ifndef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[3] + (p[2] << 8) + (p[1] << 16) + (p[0] << 24);
+ value = bswap_32 (value);
#endif
return value;
}
-
-#if 0 /* Currently not used. */
-
-/* Convert 16-bit value VALUE which is in big-endian byte-order
- to host byte-order. */
-
-static u_int16_t
-be2hs (u_int16_t value)
-{
-#ifndef WORDS_BIGENDIAN
- unsigned char *p = (unsigned char *) &value;
- value = p[1] + (p[0] << 8);
-#endif
- return value;
-}
-
-#endif /* 0 */
-
/***********************************************************************
RIFF-WAVE (*.wav)
***********************************************************************/