[PATCH 19/26] defs: Add widen_to_ulong macro

Eugene Syromyatnikov evgsyr at gmail.com
Mon Oct 24 03:02:19 UTC 2016


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 6566488..8f34679 100644
--- a/defs.h
+++ b/defs.h
@@ -760,6 +760,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) ((long)(v))
+#endif
+
 /*
  * Zero-extend a signed integer type to unsigned long long.
  */
-- 
1.7.10.4





More information about the Strace-devel mailing list