From: Dmitry V. Levin Date: Mon, 26 Dec 2016 17:06:12 +0000 (+0000) Subject: Simplify print_lld_from_low_high_val ifdefery X-Git-Tag: v4.16~142 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8990b601c264e75be8e4a8f797944ca19bc40af1;p=strace Simplify print_lld_from_low_high_val ifdefery 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. --- diff --git a/io.c b/io.c index dbef2e65..94dcf88b 100644 --- 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 }