Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Add union u64_swap type for swapping u64 data

The following union:
union {
u64 val64;
u32 val32[2];
} u;

is used on more than one place in perf code and will be used more in
upcomming patches.

Adding union u64_swap to have it defined globaly so we dont need to
redefine it all the time.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1337151548-2396-4-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
6a11f92e e108c66e

+7 -8
+2 -8
tools/perf/util/evsel.c
··· 462 462 * used for cross-endian analysis. See git commit 65014ab3 463 463 * for why this goofiness is needed. 464 464 */ 465 - union { 466 - u64 val64; 467 - u32 val32[2]; 468 - } u; 465 + union u64_swap u; 469 466 470 467 memset(data, 0, sizeof(*data)); 471 468 data->cpu = data->pid = data->tid = -1; ··· 605 608 * used for cross-endian analysis. See git commit 65014ab3 606 609 * for why this goofiness is needed. 607 610 */ 608 - union { 609 - u64 val64; 610 - u32 val32[2]; 611 - } u; 611 + union u64_swap u; 612 612 613 613 array = event->sample.array; 614 614
+5
tools/perf/util/types.h
··· 16 16 typedef unsigned char u8; 17 17 typedef signed char s8; 18 18 19 + union u64_swap { 20 + u64 val64; 21 + u32 val32[2]; 22 + }; 23 + 19 24 #endif /* __PERF_TYPES_H */