[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/47] rules.mak: New logical functions
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 01/47] rules.mak: New logical functions |
Date: |
Fri, 13 Sep 2013 17:12:06 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 |
Il 13/09/2013 17:02, Peter Maydell ha scritto:
> On 13 September 2013 15:55, Paolo Bonzini <address@hidden> wrote:
>> Il 13/09/2013 15:43, Peter Maydell ha scritto:
>>> On 25 August 2013 23:58, Ákos Kovács <address@hidden> wrote:
>>>> +eq = $(if $(subst $2,,$1)$(subst $1,,$2),n,y)
>>>> +ne = $(if $(subst $2,,$1)$(subst $1,,$2),y,n)
>>>
>>> These give the wrong answer for comparisons
>>> of 'n' with ''. Working versions:
>>>
>>> eq = $(if $(filter $(call lnot,$1),$(call lnot,$2)),y,n)
>>> ne = $(if $(filter $(call lnot,$1),$(call lnot,$2)),n,y)
>>
>> isempty/notempty are clearly string functions, where only the output is
>> of the y/n form. Seeing Akos's implementation of isempty/notempty, I
>> think the desired semantics for eq/ne/isempty/notempty are also those of
>> string functions.
>>
>> I would call your functions leqv/lxor, not eq/ne.
>
> Sounds reasonable -- I was led a little astray by
> them all being in a patch whose only documentation
> was the phrase "logical functions"...
>
>> Your patch is fine if you either rename eq/ne like this,
>> or revert them to Akos's version.
>
> It sounds like we probably want two patches:
> 1. logical functions: land/lor/leqv/lxor/lnot
> 2. string functions: eq/ne/isempty/notempty
>
> I assume we do end up using eq/ne somewhere?
I cannot think off-hand of a place where I'd use eq/ne directly rather
than isempty/notempty. Or for that matter leqv/lxor. :)
But since we're discussing the issue and the implementation of eq/ne is
not entirely trivial, I think it's simplest to have them even if they
are unused for now.
Paolo