unaligned.h 907 B

12345678910111213141516171819202122232425262728293031
  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. * If an architecture can handle unaligned accesses in hardware,
  8. * it may want to use the linux/unaligned/access_ok.h implementation
  9. * instead.
  10. */
  11. #include <asm/byteorder.h>
  12. #if defined(__LITTLE_ENDIAN)
  13. # include <linux/unaligned/le_struct.h>
  14. # include <linux/unaligned/be_byteshift.h>
  15. # include <linux/unaligned/generic.h>
  16. # define get_unaligned __get_unaligned_le
  17. # define put_unaligned __put_unaligned_le
  18. #elif defined(__BIG_ENDIAN)
  19. # include <linux/unaligned/be_struct.h>
  20. # include <linux/unaligned/le_byteshift.h>
  21. # include <linux/unaligned/generic.h>
  22. # define get_unaligned __get_unaligned_be
  23. # define put_unaligned __put_unaligned_be
  24. #else
  25. # error need to define endianess
  26. #endif
  27. #endif /* __ASM_GENERIC_UNALIGNED_H */