Am 12.07.2016 um 18:24 schrieb Paolo Bonzini:
On 12/07/2016 17:54, Eric Blake wrote:
On 07/12/2016 12:48 AM, Fam Zheng wrote:
MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it.
Huh?
Old expansion, in various stages:
(((0) != 0 && (0) < (1)) ? (0) : (1))
((0 && 1) ? 0 : 1)
(0
On Tue, Jul 12, 2016 at 02:48:33PM +0800, Fam Zheng wrote:
> MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it.
This is incorrect. The actual results are:
MIN_NON_ZERO(0, 1) = 1
MIN_NON_ZERO(1, 0) = 0
The second case is the buggy one.
>
> Reported-by: Miroslav Rezanina
> Sign
On 12/07/2016 17:54, Eric Blake wrote:
> On 07/12/2016 12:48 AM, Fam Zheng wrote:
>> MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it.
>
> Huh?
>
> Old expansion, in various stages:
>
> (((0) != 0 && (0) < (1)) ? (0) : (1))
> ((0 && 1) ? 0 : 1)
> (0 ? 0 : 1)
> 1
>
> Maybe you
On 07/12/2016 12:48 AM, Fam Zheng wrote:
> MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it.
Huh?
Old expansion, in various stages:
(((0) != 0 && (0) < (1)) ? (0) : (1))
((0 && 1) ? 0 : 1)
(0 ? 0 : 1)
1
Maybe you meant MIN_NON_ZERO(1, 0), which evaluates to:
(((1) != 0 && (1)
MIN_NON_ZERO(0, 1) is evaluated to 0. Rewrite the macro to fix it.
Reported-by: Miroslav Rezanina
Signed-off-by: Fam Zheng
---
include/qemu/osdep.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index e63da28..e4c6ae6 100644
---