[xiph-commits] r10418 - trunk/postfish

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Nov 20 18:49:30 PST 2005


Author: xiphmont
Date: 2005-11-20 18:49:28 -0800 (Sun, 20 Nov 2005)
New Revision: 10418

Modified:
   trunk/postfish/input.c
   trunk/postfish/postfish.h
   trunk/postfish/version.h
Log:
Corrections necessary for proper compilation by GCC 4.x



Modified: trunk/postfish/input.c
===================================================================
--- trunk/postfish/input.c	2005-11-21 00:05:41 UTC (rev 10417)
+++ trunk/postfish/input.c	2005-11-21 02:49:28 UTC (rev 10418)
@@ -312,7 +312,7 @@
 
       /* Crappy! Use a lib to do this for pete's sake! */
       if(f){
-	unsigned char headerid[12];
+	char headerid[12];
 	off_t filelength;
 	fe->f=f;
 	

Modified: trunk/postfish/postfish.h
===================================================================
--- trunk/postfish/postfish.h	2005-11-21 00:05:41 UTC (rev 10417)
+++ trunk/postfish/postfish.h	2005-11-21 02:49:28 UTC (rev 10418)
@@ -85,22 +85,43 @@
 
 #ifdef UGLY_IEEE754_FLOAT32_HACK
 
-static inline float todB_a(float x){
-  return (float)((*((int32_t *)&x))&0x7fffffff) * 7.17711438e-7f -764.6161886f;
+static inline float todB_a(const float x){
+  union {
+    u_int32_t i;
+    float f;
+  } ix;
+  ix.f = x;
+  ix.i = ix.i&0x7fffffff;
+  return (float)(ix.i * 7.17711438e-7f -764.6161886f);
 }
 
 // eliminate a *.5 in ops on sq magnitudes
-static inline float todB_a2(float x){
-  return (float)((*((int32_t *)&x))&0x7fffffff) * 3.58855719e-7f -382.3080943f;
+static inline float todB_a2(const float x){
+  union {
+    u_int32_t i;
+    float f;
+  } ix;
+  ix.f = x;
+  ix.i = ix.i&0x7fffffff;
+  return (float)(ix.i * 3.58855719e-7f -382.3080943f);
 }
 
-static inline float fromdB_a(float x){
-  int y=(x < -300.f ? 0 : 1.39331762961e+06f*(x+764.6161886f));
-  return *(float *)&y;
+static inline float fromdB_a(const float x){
+  union {
+    u_int32_t i;
+    float f;
+  } ix;
+  ix.i = (x < -300.f ? 0 : 1.39331762961e+06f*(x+764.6161886f));
+  return ix.f;
 }
 
 static inline void underguard(float *x){
-  if(((*(int32_t *) &x) & 0x7f800000)==0) *x=0.0f;
+  union {
+    u_int32_t i;
+    float f;
+  } ix;
+  ix.f = *x;
+  if((ix.i & 0x7f800000)==0) *x=0.0f;
 }
 
 #else

Modified: trunk/postfish/version.h
===================================================================
--- trunk/postfish/version.h	2005-11-21 00:05:41 UTC (rev 10417)
+++ trunk/postfish/version.h	2005-11-21 02:49:28 UTC (rev 10418)
@@ -1,2 +1,2 @@
 #define VERSION "$Id$ "
-/* DO NOT EDIT: Automated versioning hack [Thu Jan 20 00:32:25 EST 2005] */
+/* DO NOT EDIT: Automated versioning hack [Sun Nov 20 21:43:22 EST 2005] */



More information about the commits mailing list