add gcc4 fixes, remove the NEC FC20X2JA driver patch from lcd4linux temporary
[openwrt-10.03/.git] / package / libvorbis / patches / libvorbis-1.1.1-gcc4-1.patch
1 Submitted By: Steffen Knollmann <sknolli at astro.physik.uni-goettingen.de>
2 Date: 2005-11-09
3 Initial Package Version: 1.1.1
4 Upstream Status: From Upstream
5 Origin: msmith, courtesy of upstream SVN
6 Description: Fixes an optimization problem with gcc-4.0.x that results in
7              dysfunctional library that will produce bigger encoded files
8              with a poor audio quality. Detailed description at:
9              http://trac.xiph.org/cgi-bin/trac.cgi/ticket/583
10
11 $LastChangedBy: randy $
12 $Date: 2005-11-18 08:12:42 -0700 (Fri, 18 Nov 2005) $
13
14
15 --- libvorbis-1.1.1/lib/scales.h        (revision 9958)
16 +++ libvorbis-1.1.1/lib/scales.h        (revision 9959)
17 @@ -26,20 +26,24 @@
18  #ifdef VORBIS_IEEE_FLOAT32
19  
20  static float unitnorm(float x){
21 -  ogg_uint32_t *ix=(ogg_uint32_t *)&x;
22 -  *ix=(*ix&0x80000000UL)|(0x3f800000UL);
23 -  return(x);
24 -}
25 -
26 -static float FABS(float *x){
27 -  ogg_uint32_t *ix=(ogg_uint32_t *)x;
28 -  *ix&=0x7fffffffUL;
29 -  return(*x);
30 +  union {
31 +    ogg_uint32_t i;
32 +    float f;
33 +  } ix;
34 +  ix.f = x;
35 +  ix.i = (ix.i & 0x80000000U) | (0x3f800000U);
36 +  return ix.f;
37  }
38  
39  /* Segher was off (too high) by ~ .3 decibel.  Center the conversion correctly. */
40  static float todB(const float *x){
41 -  return (float)((*(ogg_int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f;
42 +  union {
43 +    ogg_uint32_t i;
44 +    float f;
45 +  } ix;
46 +  ix.f = *x;
47 +  ix.i = ix.i&0x7fffffff;
48 +  return (float)(ix.i * 7.17711438e-7f -764.6161886f);
49  }
50  
51  #define todB_nn(x) todB(x)
52 @@ -51,8 +55,6 @@
53    return(1.f);
54  }
55  
56 -#define FABS(x) fabs(*(x))
57 -
58  #define todB(x)   (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
59  #define todB_nn(x)   (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
60