1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-30 15:29:56 +00:00

- 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
This commit is contained in:
jkeil 2002-09-06 17:34:52 +00:00
parent 1258b3e4ac
commit e4de7b6322

View File

@ -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; } \