From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgHGW-0004B9-HX for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:52:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgHGS-0007Tc-Gu for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:52:04 -0500 Received: from mail-qc0-f173.google.com ([209.85.216.173]:60505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgHGS-0007TW-CF for qemu-devel@nongnu.org; Wed, 05 Dec 2012 10:52:00 -0500 Received: by mail-qc0-f173.google.com with SMTP id b12so2808936qca.4 for ; Wed, 05 Dec 2012 07:51:59 -0800 (PST) Sender: Richard Henderson Message-ID: <50BF6D9D.2030901@twiddle.net> Date: Wed, 05 Dec 2012 09:51:57 -0600 From: Richard Henderson MIME-Version: 1.0 References: <1354663750-2163-1-git-send-email-petar.jovanovic@rt-rk.com> <50BF69EA.8080306@twiddle.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] target-mips: Fix incorrect shift for SHILO and SHILOV List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: rth7680@gmail.com, Petar Jovanovic , qemu-devel@nongnu.org, blauwirbel@gmail.com, petarj@mips.com, afaerber@suse.de, aurelien@aurel32.net On 2012-12-05 09:49, Peter Maydell wrote: > On 5 December 2012 15:36, Richard Henderson wrote: >> On 2012-12-04 17:29, Petar Jovanovic wrote: >>> rs5_0 = (int8_t)(rs5_0 << 2) >> 2; >> >> This is more portably written as >> >> rs5_0 = (rs5_0 ^ 0x20) - 0x20; > > ...but way more obscurely. If we want to play that > kind of game can we have a sign-extension function in > a header somewhere? I dunno about more obscurely. It took me a minute to figure out what was wanted in the original. As for a helper function... sure. r~