xref: /kernel/linux/linux-5.10/tools/perf/util/memswap.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/tools/perf/util/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include <byteswap.h>
38c2ecf20Sopenharmony_ci#include "memswap.h"
48c2ecf20Sopenharmony_ci#include <linux/types.h>
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_civoid mem_bswap_32(void *src, int byte_size)
78c2ecf20Sopenharmony_ci{
88c2ecf20Sopenharmony_ci	u32 *m = src;
98c2ecf20Sopenharmony_ci	while (byte_size > 0) {
108c2ecf20Sopenharmony_ci		*m = bswap_32(*m);
118c2ecf20Sopenharmony_ci		byte_size -= sizeof(u32);
128c2ecf20Sopenharmony_ci		++m;
138c2ecf20Sopenharmony_ci	}
148c2ecf20Sopenharmony_ci}
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_civoid mem_bswap_64(void *src, int byte_size)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	u64 *m = src;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	while (byte_size > 0) {
218c2ecf20Sopenharmony_ci		*m = bswap_64(*m);
228c2ecf20Sopenharmony_ci		byte_size -= sizeof(u64);
238c2ecf20Sopenharmony_ci		++m;
248c2ecf20Sopenharmony_ci	}
258c2ecf20Sopenharmony_ci}
26

Indexes created Thu Nov 07 10:32:03 CST 2024