From e4de7b63224896b59146a5ae46ede76bf85b53b5 Mon Sep 17 00:00:00 2001 From: jkeil Date: Fri, 6 Sep 2002 17:34:52 +0000 Subject: - 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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7300 b3059339-0415-0410-9bf9-f77b7e298cf2 --- mp3lib/decod386.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'mp3lib/decod386.c') diff --git a/mp3lib/decod386.c b/mp3lib/decod386.c index 5928270958..ca9979b2a4 100644 --- a/mp3lib/decod386.c +++ b/mp3lib/decod386.c @@ -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; } \ -- cgit v1.2.3