qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] util: Fix MIN_NON_ZERO


From: Peter Lieven
Subject: Re: [Qemu-devel] [PATCH] util: Fix MIN_NON_ZERO
Date: Mon, 18 Jul 2016 10:00:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

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 ? 0 : 1)
1

Maybe you meant MIN_NON_ZERO(1, 0), which evaluates to:

(((1) != 0 && (1) < (0)) ? (1) : (0))
((1 && 0) ? 1 : 0)
(0 ? 1 : 0)
0

in which case, you are correct that there is a bug.
Commit message fixed, patch queued.

Paolo

Shouldn't we Cc qemu-stable?

Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]