summaryrefslogtreecommitdiffstats
path: root/mp3lib/decod386.c
diff options
context:
space:
mode:
authorjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-06 17:34:52 +0000
committerjkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-09-06 17:34:52 +0000
commite4de7b63224896b59146a5ae46ede76bf85b53b5 (patch)
tree3fcef483113f17d1a8d745a7e52ac5e516e75808 /mp3lib/decod386.c
parent1258b3e4ac9bbb1fd72b1c9d33b57b528853e684 (diff)
downloadmpv-e4de7b63224896b59146a5ae46ede76bf85b53b5.tar.bz2
mpv-e4de7b63224896b59146a5ae46ede76bf85b53b5.tar.xz
- 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
Diffstat (limited to 'mp3lib/decod386.c')
-rw-r--r--mp3lib/decod386.c13
1 files changed, 3 insertions, 10 deletions
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; } \