qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] audio: split IN_T into two separate constants
@ 2012-05-18 11:08 Roger Pau Monne
  2012-05-18 11:28 ` malc
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Pau Monne @ 2012-05-18 11:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Roger Pau Monne

Split IN_T into BSIZE and ITYPE, to avoid expansion if the OS has
defined macros for the intX_t and uintX_t types. The IN_T constant is
then defined in mixeng_template.h so it can be used by the
functions/macros on this header file.

This change has been tested successfully under Debian Linux and NetBSD
6.0BETA.

Cc: Vassili Karpov (malc) <av1474@comtv.ru>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
---
 audio/mixeng.c          |   36 ++++++++++++++++++++++++------------
 audio/mixeng_template.h |    4 +++-
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/audio/mixeng.c b/audio/mixeng.c
index 5446be6..02a9d9f 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -33,7 +33,8 @@
 #define ENDIAN_CONVERT(v) (v)
 
 /* Signed 8 bit */
-#define IN_T int8_t
+#define BSIZE 8
+#define ITYPE int
 #define IN_MIN SCHAR_MIN
 #define IN_MAX SCHAR_MAX
 #define SIGNED
@@ -42,25 +43,29 @@
 #undef SIGNED
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 /* Unsigned 8 bit */
-#define IN_T uint8_t
+#define BSIZE 8
+#define ITYPE uint
 #define IN_MIN 0
 #define IN_MAX UCHAR_MAX
 #define SHIFT 8
 #include "mixeng_template.h"
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 #undef ENDIAN_CONVERT
 #undef ENDIAN_CONVERSION
 
 /* Signed 16 bit */
-#define IN_T int16_t
+#define BSIZE 16
+#define ITYPE int
 #define IN_MIN SHRT_MIN
 #define IN_MAX SHRT_MAX
 #define SIGNED
@@ -78,11 +83,13 @@
 #undef SIGNED
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 /* Unsigned 16 bit */
-#define IN_T uint16_t
+#define BSIZE 16
+#define ITYPE uint
 #define IN_MIN 0
 #define IN_MAX USHRT_MAX
 #define SHIFT 16
@@ -98,11 +105,13 @@
 #undef ENDIAN_CONVERSION
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 /* Signed 32 bit */
-#define IN_T int32_t
+#define BSIZE 32
+#define ITYPE int
 #define IN_MIN INT32_MIN
 #define IN_MAX INT32_MAX
 #define SIGNED
@@ -120,11 +129,13 @@
 #undef SIGNED
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 /* Unsigned 32 bit */
-#define IN_T uint32_t
+#define BSIZE 32
+#define ITYPE uint
 #define IN_MIN 0
 #define IN_MAX UINT32_MAX
 #define SHIFT 32
@@ -140,7 +151,8 @@
 #undef ENDIAN_CONVERSION
 #undef IN_MAX
 #undef IN_MIN
-#undef IN_T
+#undef BSIZE
+#undef ITYPE
 #undef SHIFT
 
 t_sample *mixeng_conv[2][2][2][3] = {
diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h
index e644c23..30849a6 100644
--- a/audio/mixeng_template.h
+++ b/audio/mixeng_template.h
@@ -31,7 +31,8 @@
 #define HALF (IN_MAX >> 1)
 #endif
 
-#define ET glue (ENDIAN_CONVERSION, glue (_, IN_T))
+#define ET glue (ENDIAN_CONVERSION, glue (glue (glue (_, ITYPE), BSIZE), _t))
+#define IN_T glue (glue (ITYPE, BSIZE), _t)
 
 #ifdef FLOAT_MIXENG
 static mixeng_real inline glue (conv_, ET) (IN_T v)
@@ -150,3 +151,4 @@ static void glue (glue (clip_, ET), _from_mono)
 
 #undef ET
 #undef HALF
+#undef IN_T
-- 
1.7.7.5 (Apple Git-26)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] audio: split IN_T into two separate constants
  2012-05-18 11:08 [Qemu-devel] [PATCH] audio: split IN_T into two separate constants Roger Pau Monne
@ 2012-05-18 11:28 ` malc
  2012-05-18 13:11   ` Roger Pau Monne
  0 siblings, 1 reply; 3+ messages in thread
From: malc @ 2012-05-18 11:28 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: qemu-devel

On Fri, 18 May 2012, Roger Pau Monne wrote:

> Split IN_T into BSIZE and ITYPE, to avoid expansion if the OS has
> defined macros for the intX_t and uintX_t types. The IN_T constant is
> then defined in mixeng_template.h so it can be used by the
> functions/macros on this header file.
> 
> This change has been tested successfully under Debian Linux and NetBSD
> 6.0BETA.
> 

Applied.

[..snip..]

-- 
mailto:av1474@comtv.ru

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] audio: split IN_T into two separate constants
  2012-05-18 11:28 ` malc
@ 2012-05-18 13:11   ` Roger Pau Monne
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Pau Monne @ 2012-05-18 13:11 UTC (permalink / raw)
  To: malc; +Cc: qemu-devel@nongnu.org

malc wrote:
> On Fri, 18 May 2012, Roger Pau Monne wrote:
>
>> Split IN_T into BSIZE and ITYPE, to avoid expansion if the OS has
>> defined macros for the intX_t and uintX_t types. The IN_T constant is
>> then defined in mixeng_template.h so it can be used by the
>> functions/macros on this header file.
>>
>> This change has been tested successfully under Debian Linux and NetBSD
>> 6.0BETA.
>>
>
> Applied.

Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-18 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-18 11:08 [Qemu-devel] [PATCH] audio: split IN_T into two separate constants Roger Pau Monne
2012-05-18 11:28 ` malc
2012-05-18 13:11   ` Roger Pau Monne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).