[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] hw/audio/fmopl.c: Avoid clang warning about shiftin
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH] hw/audio/fmopl.c: Avoid clang warning about shifting negative number |
Date: |
Mon, 16 Nov 2015 15:16:50 +0000 |
Newer versions of clang warn:
hw/audio/fmopl.c:1085:39: warning: shifting a negative signed value is
undefined [-Wshift-negative-value]
data = Limit( outd[0] , OPL_MAXOUT, OPL_MINOUT );
^~~~~~~~~~
hw/audio/fmopl.c:75:28: note: expanded from macro 'OPL_MINOUT'
#define OPL_MINOUT (-0x8000<<OPL_OUTSB)
~~~~~~~^
Rephrase the definition of OPL_MINOUT to avoid the undefined behaviour.
Signed-off-by: Peter Maydell <address@hidden>
---
hw/audio/fmopl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
index 81c0c1b..807b29c 100644
--- a/hw/audio/fmopl.c
+++ b/hw/audio/fmopl.c
@@ -72,7 +72,7 @@ static int opl_dbg_maxchip,opl_dbg_chip;
/* final output shift , limit minimum and maximum */
#define OPL_OUTSB (TL_BITS+3-16) /* OPL output final shift 16bit
*/
#define OPL_MAXOUT (0x7fff<<OPL_OUTSB)
-#define OPL_MINOUT (-0x8000<<OPL_OUTSB)
+#define OPL_MINOUT (-(0x8000<<OPL_OUTSB))
/* -------------------- quality selection --------------------- */
--
1.9.1
- [Qemu-devel] [PATCH] hw/audio/fmopl.c: Avoid clang warning about shifting negative number,
Peter Maydell <=