Commit 8f71d69a authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

tools: fix dumping cross-endian 64-bit

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 651c6bf2
...@@ -34,9 +34,7 @@ static long long wrpc_get_64(void *p) ...@@ -34,9 +34,7 @@ static long long wrpc_get_64(void *p)
uint64_t result; uint64_t result;
if (endian_flag == DUMP_ENDIAN_FLAG) { if (endian_flag == DUMP_ENDIAN_FLAG) {
result = *p64 >> 32; return *p64;
result |= (uint32_t)*p64;
return result;
} }
result = __bswap_32((uint32_t)(*p64 >> 32)); result = __bswap_32((uint32_t)(*p64 >> 32));
result <<= 32; result <<= 32;
...@@ -57,20 +55,6 @@ static int wrpc_get_i32(void *p) ...@@ -57,20 +55,6 @@ static int wrpc_get_i32(void *p)
{ {
return wrpc_get_l32(p); return wrpc_get_l32(p);
} }
static int64_t wrpc_get_i64(void *p)
{
int64_t *p64 = p, i64;
if (endian_flag == DUMP_ENDIAN_FLAG)
return *p64;
/* uff... */
i64 = *p64;
i64 = __bswap_32(i64 & 0xffffffff);
i64 <<= 32;
i64 |= __bswap_32(i64 >> 32);
return i64;
}
static int wrpc_get_16(void *p) static int wrpc_get_16(void *p)
{ {
uint16_t *p16 = p; uint16_t *p16 = p;
...@@ -153,8 +137,8 @@ void dump_one_field(void *addr, struct dump_info *info) ...@@ -153,8 +137,8 @@ void dump_one_field(void *addr, struct dump_info *info)
case dump_type_pp_time: case dump_type_pp_time:
{ {
struct pp_time localt; struct pp_time localt;
localt.secs = wrpc_get_i64(&t->secs); localt.secs = wrpc_get_64(&t->secs);
localt.scaled_nsecs = wrpc_get_i64(&t->scaled_nsecs); localt.scaled_nsecs = wrpc_get_64(&t->scaled_nsecs);
printf("correct %i: %10lli.%09li:0x%04x\n", printf("correct %i: %10lli.%09li:0x%04x\n",
!is_incorrect(&localt), !is_incorrect(&localt),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment