qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] target-s390x: fix CONVERT TO BINARY (CVD, CVDY)


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] target-s390x: fix CONVERT TO BINARY (CVD, CVDY)
Date: Tue, 30 Jun 2015 09:27:33 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.7.0


On 30.06.15 07:53, Richard Henderson wrote:
> On 06/29/2015 09:24 PM, Aurelien Jarno wrote:
>> On 2015-06-29 10:28, Richard Henderson wrote:
>>> On 06/25/2015 08:16 PM, Aurelien Jarno wrote:
>>>>       for (shift = 4; (shift < 64) && bin; shift += 4) {
>>>> -        int current_number = bin % 10;
>>>> -
>>>> -        dec |= (current_number) << shift;
>>>> +        dec |= (bin % 10) << shift;
>>>>           bin /= 10;
>>>>       }
>>>
>>> You've changed from 32-bit division to 64-bit division just to solve a
>>> problem with the shift.  Better to just change the type of
>>> current_number
>>> there.
>>
>> Changing the type of current_number instead of bin would indeed solve
>> the shift issue, but not the -2^31 case. As we take the absolute value,
>> we need a 64-bit variable to hold the corresponding 2^31 value.
>>
> 
> Ah, true enough.  I suppose adding a 32-bit unsigned variable with which
> to do the division is more trouble than it's worth.
> 
> Reviewed-by: Richard Henderson <address@hidden>

Thanks, applied to s390-next.


Alex



reply via email to

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