[xiph-cvs] cvs commit: speex/libspeex misc.h

Jean-Marc Valin jm at xiph.org
Mon Oct 27 15:05:53 PST 2003



jm          03/10/27 18:05:53

  Modified:    libspeex misc.h
  Log:
  fixed-point: don't cast MUL* operands to int. Compiler should generate
  better code now.

Revision  Changes    Path
1.37      +9 -9      speex/libspeex/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- misc.h	24 Oct 2003 15:01:08 -0000	1.36
+++ misc.h	27 Oct 2003 23:05:53 -0000	1.37
@@ -62,16 +62,16 @@
 /* result fits in 16 bits */
 #define MULT16_16_16(a,b)     (((short)(a))*(b))
 
-#define MULT16_16(a,b)     (((signed int)(a))*(b))
-#define MULT16_32_Q13(a,b) (((a)*((b)>>13)) + ((a)*((signed int)((b)&0x00001fff))>>13))
-#define MULT16_32_Q14(a,b) (((a)*((b)>>14)) + ((a)*((signed int)((b)&0x00003fff))>>14))
-#define MULT16_32_Q15(a,b) (((a)*((b)>>15)) + ((a)*((signed int)((b)&0x00007fff))>>15))
-
-#define MULT16_16_Q13(a,b) (((signed int)(a))*(b)>>13)
-#define MULT16_16_Q14(a,b) (((signed int)(a))*(b)>>14)
-#define MULT16_16_Q15(a,b) (((signed int)(a))*(b)>>15)
+#define MULT16_16(a,b)     (((a))*(b))
+#define MULT16_32_Q13(a,b) (((a)*((b)>>13)) + ((a)*((short)((b)&0x00001fff))>>13))
+#define MULT16_32_Q14(a,b) (((a)*((b)>>14)) + ((a)*((short)((b)&0x00003fff))>>14))
+#define MULT16_32_Q15(a,b) (((a)*((b)>>15)) + ((a)*((short)((b)&0x00007fff))>>15))
+
+#define MULT16_16_Q13(a,b) (((short)(a))*(b)>>13)
+#define MULT16_16_Q14(a,b) (((short)(a))*(b)>>14)
+#define MULT16_16_Q15(a,b) (((short)(a))*(b)>>15)
 
-#define MULT16_16_P14(a,b) ((8192+((signed int)(a))*(b))>>14)
+#define MULT16_16_P14(a,b) ((8192+((short)(a))*(b))>>14)
 
 
 #define DIV32_16(a,b) (((signed int)(a))/(b))

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list