mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
aafe4dbed0
These are all kernel internal interfaces that get copied around a lot. In most cases, architectures can provide their own optimized versions, but these generic versions can work as well. I have tried to use the most common contents of each header to allow existing architectures to migrate easily. Thanks to Remis for suggesting a number of cleanups. Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
31 lines
907 B
C
31 lines
907 B
C
#ifndef __ASM_GENERIC_UNALIGNED_H
|
|
#define __ASM_GENERIC_UNALIGNED_H
|
|
|
|
/*
|
|
* This is the most generic implementation of unaligned accesses
|
|
* and should work almost anywhere.
|
|
*
|
|
* If an architecture can handle unaligned accesses in hardware,
|
|
* it may want to use the linux/unaligned/access_ok.h implementation
|
|
* instead.
|
|
*/
|
|
#include <asm/byteorder.h>
|
|
|
|
#if defined(__LITTLE_ENDIAN)
|
|
# include <linux/unaligned/le_struct.h>
|
|
# include <linux/unaligned/be_byteshift.h>
|
|
# include <linux/unaligned/generic.h>
|
|
# define get_unaligned __get_unaligned_le
|
|
# define put_unaligned __put_unaligned_le
|
|
#elif defined(__BIG_ENDIAN)
|
|
# include <linux/unaligned/be_struct.h>
|
|
# include <linux/unaligned/le_byteshift.h>
|
|
# include <linux/unaligned/generic.h>
|
|
# define get_unaligned __get_unaligned_be
|
|
# define put_unaligned __put_unaligned_be
|
|
#else
|
|
# error need to define endianess
|
|
#endif
|
|
|
|
#endif /* __ASM_GENERIC_UNALIGNED_H */
|