|
|
9ae3a8 |
From 756b23c15387acefe4139831c2f3c8a5f3d41bb2 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 18 Jul 2016 01:32:10 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 7/7] util: Fix MIN_NON_ZERO
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1468805530-19033-1-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 71200
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.3 qemu-kvm PATCH 7/6] util: Fix MIN_NON_ZERO
|
|
|
9ae3a8 |
Bugzilla: 1318199
|
|
|
9ae3a8 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
MIN_NON_ZERO(1, 0) is evaluated to 0. Rewrite the macro to fix it.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-Id: <1468306113-847-1-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit d27ba624aa1dfe5c07cc01200d95967ffce905d9)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
include/qemu/osdep.h | 3 ++-
|
|
|
9ae3a8 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
|
|
|
9ae3a8 |
index c47a600..5ca05bc 100644
|
|
|
9ae3a8 |
--- a/include/qemu/osdep.h
|
|
|
9ae3a8 |
+++ b/include/qemu/osdep.h
|
|
|
9ae3a8 |
@@ -71,7 +71,8 @@ typedef signed int int_fast16_t;
|
|
|
9ae3a8 |
/* Minimum function that returns zero only iff both values are zero.
|
|
|
9ae3a8 |
* Intended for use with unsigned values only. */
|
|
|
9ae3a8 |
#ifndef MIN_NON_ZERO
|
|
|
9ae3a8 |
-#define MIN_NON_ZERO(a, b) (((a) != 0 && (a) < (b)) ? (a) : (b))
|
|
|
9ae3a8 |
+#define MIN_NON_ZERO(a, b) ((a) == 0 ? (b) : \
|
|
|
9ae3a8 |
+ ((b) == 0 ? (a) : (MIN(a, b))))
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
#ifndef ROUND_UP
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|