Bugzilla – Attachment 48763 Details for
Bug 115135
libvorbis is miscompiled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
updated type-punning patch
libvorbis-type-punning-fix.dif (text/plain), 1.14 KB, created by
Richard Biener
on 2005-09-05 09:54:40 UTC
(
hide
)
Description:
updated type-punning patch
Filename:
MIME Type:
Creator:
Richard Biener
Created:
2005-09-05 09:54:40 UTC
Size:
1.14 KB
patch
obsolete
>--- lib/scales.h-dist 2004-08-06 03:06:31.000000000 +0200 >+++ lib/scales.h 2005-09-05 11:49:08.000000000 +0200 >@@ -25,21 +25,36 @@ > #define VORBIS_IEEE_FLOAT32 1 > #ifdef VORBIS_IEEE_FLOAT32 > >-static float unitnorm(float x){ >- ogg_uint32_t *ix=(ogg_uint32_t *)&x; >- *ix=(*ix&0x80000000UL)|(0x3f800000UL); >- return(x); >+static inline float unitnorm(float x){ >+ union { >+ ogg_uint32_t i; >+ float f; >+ } ix; >+ ix.f = x; >+ ix.i=(ix.i&0x80000000UL)|(0x3f800000UL); >+ return(ix.f); > } > > static float FABS(float *x){ >- ogg_uint32_t *ix=(ogg_uint32_t *)x; >- *ix&=0x7fffffffUL; >+ union { >+ ogg_uint32_t i; >+ float f; >+ } ix; >+ ix.f = *x; >+ ix.i = ix.i&0x7fffffffUL; >+ /* *x = ix.f; -- #define below doesn't do this, but original here did. */ > return(*x); > } > > /* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */ > static float todB(const float *x){ >- return (float)((*(ogg_int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f; >+ union { >+ ogg_int32_t i; >+ float f; >+ } ix; >+ ix.f = *x; >+ ix.i = ix.i&0x7fffffff; >+ return (float)ix.i * 7.17711438e-7f -764.6161886f; > } > > #define todB_nn(x) todB(x)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 115135
: 48763 |
48777