]> granicus.if.org Git - strace/commitdiff
Simplify print_lld_from_low_high_val ifdefery
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 17:06:12 +0000 (17:06 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 26 Dec 2016 17:06:12 +0000 (17:06 +0000)
The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
implementation.

* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
&& SIZEOF_LONG == SIZEOF_LONG_LONG]
and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
into a single [SIZEOF_KERNEL_LONG_T > 4] case.
[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
instead of zero_extend_signed_to_ull.

io.c

diff --git a/io.c b/io.c
index dbef2e65b83eb2f9bb28ed6d789f032136c92070..94dcf88bedb5e139dd82ca85e749f73bb74c34f8 100644 (file)
--- a/io.c
+++ b/io.c
@@ -177,33 +177,20 @@ SYS_FUNC(pwrite)
 static void
 print_lld_from_low_high_val(struct tcb *tcp, int arg)
 {
-#if SIZEOF_LONG > 4 && SIZEOF_LONG == SIZEOF_LONG_LONG
+#if SIZEOF_KERNEL_LONG_T > 4
 # ifndef current_klongsize
-       if (current_klongsize < SIZEOF_LONG) {
-               tprintf("%" PRI_kld, (tcp->u_arg[arg + 1] << current_wordsize * 8)
+       if (current_klongsize < SIZEOF_KERNEL_LONG_T) {
+               tprintf("%" PRI_kld, (tcp->u_arg[arg + 1] << 32)
                               | tcp->u_arg[arg]);
        } else
 # endif /* !current_klongsize */
        {
                tprintf("%" PRI_kld, tcp->u_arg[arg]);
        }
-#elif SIZEOF_LONG > 4
-# error Unsupported configuration: SIZEOF_LONG > 4 && SIZEOF_LONG_LONG > SIZEOF_LONG
-#elif SIZEOF_KERNEL_LONG_T > SIZEOF_LONG
-# ifndef current_klongsize
-       if (current_klongsize < SIZEOF_LONG_LONG) {
-               tprintf("%lld",
-                       (zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
-                       | zero_extend_signed_to_ull(tcp->u_arg[arg]));
-       } else
-# endif /* !current_klongsize */
-       {
-               tprintf("%" PRI_kld, tcp->u_arg[arg]);
-       }
-#else /* SIZEOF_LONG_LONG > SIZEOF_LONG && SIZEOF_KERNEL_LONG_T == SIZEOF_LONG */
+#else /* SIZEOF_KERNEL_LONG_T == 4 */
        tprintf("%lld",
-               (zero_extend_signed_to_ull(tcp->u_arg[arg + 1]) << sizeof(long) * 8)
-               | zero_extend_signed_to_ull(tcp->u_arg[arg]));
+                 ((long long) tcp->u_arg[arg + 1] << 32)
+               | ((long long) tcp->u_arg[arg]));
 #endif
 }