changeset 7299:131497b1f6ad

- GCC 3.x (SPARC) is too clever for the double->int conversion trick used in the WRITE_SAMPLE macro. Use a union instead of a cast to get at the binary representation of the double's mantissa. This should fix: http://mplayerhq.hu/pipermail/mplayer-users/2002-August/018948.html http://mplayerhq.hu/pipermail/mplayer-users/2002-August/019296.html http://mplayerhq.hu/pipermail/mplayer-users/2002-September/020348.html - garbage collect the unused CAN_COMPILE_X86 define
author jkeil
date Fri, 06 Sep 2002 17:34:52 +0000
parents 641b287f8b07
children 6863d4ba6de5
files mp3lib/decod386.c
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mp3lib/decod386.c	Fri Sep 06 16:51:16 2002 +0000
+++ b/mp3lib/decod386.c	Fri Sep 06 17:34:52 2002 +0000
@@ -13,13 +13,6 @@
 
 #include "../config.h"
 
-#ifndef CAN_COMPILE_X86
-#ifdef  ARCH_X86
-#define CAN_COMPILE_X86
-#endif
-#endif
-
-
 #if 0
  /* old WRITE_SAMPLE */
    /* is portable */
@@ -63,9 +56,9 @@
 
    /* sizeof(int) == 4 */
 #define WRITE_SAMPLE(samples,sum,clip) { \
-  double dtemp; int v;                  \
-  dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
-  v = (((int *)&dtemp)[MANTISSA_OFFSET] - 0x80000000); \
+  union { double dtemp; int itemp[2]; } u; int v; \
+  u.dtemp = ((((65536.0 * 65536.0 * 16)+(65536.0 * 0.5))* 65536.0)) + (sum);\
+  v = u.itemp[MANTISSA_OFFSET] - 0x80000000; \
   if( v > 32767) { *(samples) = 0x7fff; (clip)++; } \
   else if( v < -32768) { *(samples) = -0x8000; (clip)++; } \
   else { *(samples) = v; } \