unaligned.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef __ASM_GENERIC_UNALIGNED_H
  2. #define __ASM_GENERIC_UNALIGNED_H
  3. /*
  4. * This is the most generic implementation of unaligned accesses
  5. * and should work almost anywhere.
  6. */
  7. #include <asm/byteorder.h>
  8. /* Set by the arch if it can handle unaligned accesses in hardware. */
  9. #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  10. # include <linux/unaligned/access_ok.h>
  11. #endif
  12. #if defined(__LITTLE_ENDIAN)
  13. # ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  14. # include <linux/unaligned/le_struct.h>
  15. # include <linux/unaligned/be_byteshift.h>
  16. # endif
  17. # include <linux/unaligned/generic.h>
  18. # define get_unaligned __get_unaligned_le
  19. # define put_unaligned __put_unaligned_le
  20. #elif defined(__BIG_ENDIAN)
  21. # ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
  22. # include <linux/unaligned/be_struct.h>
  23. # include <linux/unaligned/le_byteshift.h>
  24. # endif
  25. # include <linux/unaligned/generic.h>
  26. # define get_unaligned __get_unaligned_be
  27. # define put_unaligned __put_unaligned_be
  28. #else
  29. # error need to define endianess
  30. #endif
  31. #endif /* __ASM_GENERIC_UNALIGNED_H */