qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] target-s390x: fix CONVERT TO BINARY (CVD, CVDY)
Date: Tue, 30 Jun 2015 06:53:58 +0100	[thread overview]
Message-ID: <55922EF6.4050605@twiddle.net> (raw)
In-Reply-To: <20150629202401.GN931@aurel32.net>

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 <rth@twiddle.net>


r~

  reply	other threads:[~2015-06-30  5:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 19:16 [Qemu-devel] [PATCH] target-s390x: fix CONVERT TO BINARY (CVD, CVDY) Aurelien Jarno
2015-06-29  9:28 ` Richard Henderson
2015-06-29 20:24   ` Aurelien Jarno
2015-06-30  5:53     ` Richard Henderson [this message]
2015-06-30  7:27       ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55922EF6.4050605@twiddle.net \
    --to=rth@twiddle.net \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).