From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuH54-0005zr-W7 for qemu-devel@nongnu.org; Thu, 05 Nov 2015 04:43:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuH51-0001jk-Ph for qemu-devel@nongnu.org; Thu, 05 Nov 2015 04:43:42 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:36608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuH51-0001jd-JJ for qemu-devel@nongnu.org; Thu, 05 Nov 2015 04:43:39 -0500 Received: by wmww144 with SMTP id w144so2695238wmw.1 for ; Thu, 05 Nov 2015 01:43:39 -0800 (PST) Sender: Paolo Bonzini References: <1446473134-4330-1-git-send-email-pbonzini@redhat.com> <563777D5.6050000@redhat.com> <5639DA14.3020507@twiddle.net> <5639E1C2.80902@redhat.com> <5639E691.4050203@twiddle.net> <563A968D.705@ilande.co.uk> <563B1D91.5010701@redhat.com> <563B1F65.5000603@twiddle.net> <563B206F.3020800@redhat.com> <563B215A.5030205@twiddle.net> From: Paolo Bonzini Message-ID: <563B24C6.4020402@redhat.com> Date: Thu, 5 Nov 2015 10:43:34 +0100 MIME-Version: 1.0 In-Reply-To: <563B215A.5030205@twiddle.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-sparc: fix 32-bit truncation in fpackfix List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson , Mark Cave-Ayland , Peter Maydell Cc: Blue Swirl , QEMU Developers On 05/11/2015 10:28, Richard Henderson wrote: > On 11/05/2015 10:25 AM, Paolo Bonzini wrote: >> >> >> On 05/11/2015 10:20, Richard Henderson wrote: >>> >>>> /* Ugly code */ >>>> int64_t scaled = (uint64_t)(int64_t)src << scale; >>> >>> You mean >>> >>> int64_t scaled = (int64_t)((uint64_t)src << scale); >> >> No, that also looks like a typo. >> >> I mean: >> >> - unnecessary cast to int64_t to get the sign extension while avoiding >> the impression of a typo > > Huh. This part doesn't seem a typo to me at all. A cast _is_ obviously necessary, because src is int32_t and the result is int64_t: int32_t src = rs2 >> (word * 32); int64_t scaled = (uint64_t)src << scale; having uint64_t on the RHS and int64_t on the LHS definitely would be a WTF cause for me. Paolo