perf memswap: Split the byteswap memory range wrappers from util.[ch]
Just one more step into splitting util.[ch] to reduce the includes hell. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-navarr9mijkgwgbzu464dwam@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
24
tools/perf/util/memswap.c
Normal file
24
tools/perf/util/memswap.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <byteswap.h>
|
||||
#include "memswap.h"
|
||||
#include <linux/types.h>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user