>> 4.
>>
>> [qemu/target-arm/translate-a64.c:5729]: (style) Redundant condition:
>> size<3. 'A && (!A || B)' is equivalent to 'A || B'
>>
>> if (size > 3
>> || (size < 3 && is_q)
>> || (size == 3 && !is_q)) {
>
> ...but I'm less sure about this one. I'm not even sure
> what it's trying to suggest this should simplify to:
> just dropping "size < 3" is obviously wrong, and the
> condition format isn't "A && (!A || B)" either.
Let's break it down into the 6 possibilities based on the binary *
ternary conditions being checked:
On 06/12/2015 05:01 AM, Peter Maydell wrote:
>> 4. arm/translate- a64.c:5729] : (style) Redundant condition:
>>
>> [qemu/target-
>> size<3. 'A && (!A || B)' is equivalent to 'A || B'
>>
>> if (size > 3
>> || (size < 3 && is_q)
>> || (size == 3 && !is_q)) {
>
> ...but I'm less sure about this one. I'm not even sure
> what it's trying to suggest this should simplify to:
> just dropping "size < 3" is obviously wrong, and the
> condition format isn't "A && (!A || B)" either.
Let's break it down into the 6 possibilities based on the binary *
ternary conditions being checked:
> 3, is_q => accept
> 3, !is_q => accept
== 3, is_q => reject
== 3, !is_q => accept
< 3, is_q => accept
< 3, !is_q => reject
Here's a shorter conditional with the same properties, but it's gross:
if (size > 3 || (is_q != (size == 3))) {
Too much mental thought to prove it accepts the same set of conditions.
-- libvirt. org
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://