From 714d68127ac10a36ab7758f0812e47e2f2c06ccf Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 20 Oct 2016 11:33:51 +0300 Subject: [PATCH] defs: add widen_to_ulong macro This is similar to widen_to_long, but for unsigned values. * defs.h (widen_to_ulong): New macro. --- defs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/defs.h b/defs.h index 63e5e93c..7dc9ccef 100644 --- a/defs.h +++ b/defs.h @@ -759,6 +759,14 @@ extern unsigned current_wordsize; # define widen_to_long(v) ((long)(v)) #endif +#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4 +# define widen_to_ulong(v) \ + (current_wordsize == 4 ? (unsigned long) (uint32_t) (v) : \ + (unsigned long) (v)) +#else +# define widen_to_ulong(v) ((unsigned long)(v)) +#endif + /* * Zero-extend a signed integer type to unsigned long long. */ -- 2.40.0