diff options
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r-- | tools/perf/util/util.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 8f63dba..42ad667 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -10,6 +10,7 @@ #include <string.h> #include <errno.h> #include <limits.h> +#include <byteswap.h> #include <linux/kernel.h> /* @@ -515,3 +516,24 @@ int perf_event_paranoid(void) return value; } + +void mem_bswap_32(void *src, int byte_size) +{ + u32 *m = src; + while (byte_size > 0) { + *m = bswap_32(*m); + byte_size -= sizeof(u32); + ++m; + } +} + +void mem_bswap_64(void *src, int byte_size) +{ + u64 *m = src; + + while (byte_size > 0) { + *m = bswap_64(*m); + byte_size -= sizeof(u64); + ++m; + } +} |