]> granicus.if.org Git - strace/commitdiff
defs: add widen_to_ulong macro
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 20 Oct 2016 08:33:51 +0000 (11:33 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 28 Oct 2016 18:40:11 +0000 (18:40 +0000)
This is similar to widen_to_long, but for unsigned values.

* defs.h (widen_to_ulong): New macro.

defs.h

diff --git a/defs.h b/defs.h
index 63e5e93cf0c75ad819f70ebd82d9563bb03e8238..7dc9ccef44c292d31f33f4454633883b3794a537 100644 (file)
--- 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.
  */