[Mplayer-cvslog] CVS: main/mp3lib decod386.c,1.11,1.12

Jürgen Keil jkeil at mplayerhq.hu
Fri Sep 6 19:35:09 CEST 2002


Update of /cvsroot/mplayer/main/mp3lib
In directory mail:/var/tmp.root/cvs-serv16675

Modified Files:
	decod386.c 
Log Message:
- 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


Index: decod386.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp3lib/decod386.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- decod386.c	23 Jan 2002 17:09:58 -0000	1.11
+++ decod386.c	6 Sep 2002 17:34:52 -0000	1.12
@@ -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; } \




More information about the MPlayer-cvslog mailing list