Received: from eggs.gnu.org ([2001:4830:134:3::10]:56390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wnha7-0002IY-93 for qemu-devel@nongnu.org; Fri, 23 May 2014 00:59:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WnhZt-0005iS-2Z for qemu-devel@nongnu.org; Fri, 23 May 2014 00:59:47 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:50157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WnhZs-0005h8-99 for qemu-devel@nongnu.org; Fri, 23 May 2014 00:59:33 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 May 2014 14:59:27 +1000 From: Alexey Kardashevskiy Date: Fri, 23 May 2014 14:59:15 +1000 Message-Id: <1400821160-25258-3-git-send-email-aik@ozlabs.ru> In-Reply-To: <1400821160-25258-1-git-send-email-aik@ozlabs.ru> References: <1400821160-25258-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v6 2/7] int128: Add int128_exts64() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Alex Williamson , qemu-ppc@nongnu.org, Alexander Graf This adds macro to extend signed 64bit value to signed 128bit value. Signed-off-by: Alexey Kardashevskiy Reviewed-by: Paolo Bonzini --- Changes: v2: * (.hi = (a >> 63) ? -1 : 0) changed to (.hi = (a < 0) ? -1 : 0) --- 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 }; -- 1.9.rc0