tools include: Add byte-swapping macros to kernel.h
Add byte-swapping macros to kernel.h Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Link: http://lkml.kernel.org/r/1495786658-18063-23-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Родитель
1405720d4f
Коммит
07fda552f1
|
@ -5,6 +5,8 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
|
#include <endian.h>
|
||||||
|
#include <byteswap.h>
|
||||||
|
|
||||||
#ifndef UINT_MAX
|
#ifndef UINT_MAX
|
||||||
#define UINT_MAX (~0U)
|
#define UINT_MAX (~0U)
|
||||||
|
@ -67,12 +69,33 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
* Both need more care to handle endianness
|
#define cpu_to_le16 bswap_16
|
||||||
* (Don't use bitmap_copy_le() for now)
|
#define cpu_to_le32 bswap_32
|
||||||
*/
|
#define cpu_to_le64 bswap_64
|
||||||
#define cpu_to_le64(x) (x)
|
#define le16_to_cpu bswap_16
|
||||||
#define cpu_to_le32(x) (x)
|
#define le32_to_cpu bswap_32
|
||||||
|
#define le64_to_cpu bswap_64
|
||||||
|
#define cpu_to_be16
|
||||||
|
#define cpu_to_be32
|
||||||
|
#define cpu_to_be64
|
||||||
|
#define be16_to_cpu
|
||||||
|
#define be32_to_cpu
|
||||||
|
#define be64_to_cpu
|
||||||
|
#else
|
||||||
|
#define cpu_to_le16
|
||||||
|
#define cpu_to_le32
|
||||||
|
#define cpu_to_le64
|
||||||
|
#define le16_to_cpu
|
||||||
|
#define le32_to_cpu
|
||||||
|
#define le64_to_cpu
|
||||||
|
#define cpu_to_be16 bswap_16
|
||||||
|
#define cpu_to_be32 bswap_32
|
||||||
|
#define cpu_to_be64 bswap_64
|
||||||
|
#define be16_to_cpu bswap_16
|
||||||
|
#define be32_to_cpu bswap_32
|
||||||
|
#define be64_to_cpu bswap_64
|
||||||
|
#endif
|
||||||
|
|
||||||
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||||
int scnprintf(char * buf, size_t size, const char * fmt, ...);
|
int scnprintf(char * buf, size_t size, const char * fmt, ...);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче