From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WraHX-0007SX-U1 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 18:00:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WraHS-0000Tt-Im for qemu-devel@nongnu.org; Mon, 02 Jun 2014 18:00:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WraHR-0000S9-T4 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 18:00:34 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s52M0Xvt018632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 2 Jun 2014 18:00:33 -0400 From: Alex Williamson Date: Mon, 02 Jun 2014 16:00:32 -0600 Message-ID: <20140602220032.26111.66290.stgit@bling.home> In-Reply-To: <20140602215946.26111.16417.stgit@bling.home> References: <20140602215946.26111.16417.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PULL 3/8] int128: Add int128_exts64() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com From: Alexey Kardashevskiy This adds macro to extend signed 64bit value to signed 128bit value. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Paolo Bonzini Signed-off-by: Alex Williamson --- include/qemu/int128.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/qemu/int128.h b/include/qemu/int128.h index f597031..fb782aa 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -38,6 +38,11 @@ static inline Int128 int128_2_64(void) return (Int128) { 0, 1 }; } +static inline Int128 int128_exts64(int64_t a) +{ + return (Int128) { .lo = a, .hi = (a < 0) ? -1 : 0 }; +} + static inline Int128 int128_and(Int128 a, Int128 b) { return (Int128) { a.lo & b.lo, a.hi & b.hi };