[xiph-commits] r11395 - trunk/speex/libspeex

jm at svn.xiph.org jm at svn.xiph.org
Wed May 10 06:47:18 PDT 2006


Author: jm
Date: 2006-05-10 06:47:15 -0700 (Wed, 10 May 2006)
New Revision: 11395

Modified:
   trunk/speex/libspeex/fixed_generic.h
   trunk/speex/libspeex/pseudofloat.h
Log:
MACROS ARE EVIL. Fixed EXTEND32() and EXTRACT16() and used them properly to
fix a 16-bit bug in pseudofloat.h


Modified: trunk/speex/libspeex/fixed_generic.h
===================================================================
--- trunk/speex/libspeex/fixed_generic.h	2006-05-10 13:34:17 UTC (rev 11394)
+++ trunk/speex/libspeex/fixed_generic.h	2006-05-10 13:47:15 UTC (rev 11395)
@@ -40,8 +40,8 @@
 
 #define NEG16(x) (-(x))
 #define NEG32(x) (-(x))
-#define EXTRACT16(x) ((spx_word16_t)x)
-#define EXTEND32(x) ((spx_word32_t)x)
+#define EXTRACT16(x) ((spx_word16_t)(x))
+#define EXTEND32(x) ((spx_word32_t)(x))
 #define SHR16(a,shift) ((a) >> (shift))
 #define SHL16(a,shift) ((a) << (shift))
 #define SHR32(a,shift) ((a) >> (shift))

Modified: trunk/speex/libspeex/pseudofloat.h
===================================================================
--- trunk/speex/libspeex/pseudofloat.h	2006-05-10 13:34:17 UTC (rev 11394)
+++ trunk/speex/libspeex/pseudofloat.h	2006-05-10 13:47:15 UTC (rev 11395)
@@ -208,7 +208,7 @@
 static inline spx_int16_t FLOAT_EXTRACT16(spx_float_t a)
 {
    if (a.e<0)
-      return (a.m+(1<<(-a.e-1)))>>-a.e;
+      return EXTRACT16((EXTEND32(a.m)+(1<<(-a.e-1)))>>-a.e);
    else
       return a.m<<a.e;
 }



More information about the commits mailing list