unaligned.h 699 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
  7. */
  8. #ifndef __ASM_GENERIC_UNALIGNED_H
  9. #define __ASM_GENERIC_UNALIGNED_H
  10. #include <linux/compiler.h>
  11. #define get_unaligned(ptr) \
  12. ({ \
  13. struct __packed { \
  14. typeof(*(ptr)) __v; \
  15. } *__p = (void *) (ptr); \
  16. __p->__v; \
  17. })
  18. #define put_unaligned(val, ptr) \
  19. do { \
  20. struct __packed { \
  21. typeof(*(ptr)) __v; \
  22. } *__p = (void *) (ptr); \
  23. __p->__v = (val); \
  24. } while(0)
  25. #endif /* __ASM_GENERIC_UNALIGNED_H */