From b685f90eb75197c09c0c62090dc93c57929c94d3 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 23 Aug 2016 00:24:22 +0000 Subject: [PATCH] Add sign_extend_unsigned_to_ll macro * defs.h (sign_extend_unsigned_to_ll): New macro, mirrors zero_extend_signed_to_ull. --- defs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/defs.h b/defs.h index b17368be..c76c98ce 100644 --- a/defs.h +++ b/defs.h @@ -755,6 +755,15 @@ extern unsigned current_wordsize; sizeof(v) == sizeof(long) ? (unsigned long long) (unsigned long) (v) : \ (unsigned long long) (v)) +/* + * Sign-extend an unsigned integer type to long long. + */ +#define sign_extend_unsigned_to_ll(v) \ + (sizeof(v) == sizeof(short) ? (long long) (short) (v) : \ + sizeof(v) == sizeof(int) ? (long long) (int) (v) : \ + sizeof(v) == sizeof(long) ? (long long) (long) (v) : \ + (long long) (v)) + extern const struct_sysent sysent0[]; extern const char *const errnoent0[]; extern const char *const signalent0[]; -- 2.40.0