unaligned.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef _ASM_GENERIC_UNALIGNED_H_
  2. #define _ASM_GENERIC_UNALIGNED_H_
  3. /*
  4.  * For the benefit of those who are trying to port Linux to another
  5.  * architecture, here are some C-language equivalents. 
  6.  */
  7. #include <asm/string.h>
  8. #define get_unaligned(ptr) 
  9.   ({ __typeof__(*(ptr)) __tmp; memcpy(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
  10. #define put_unaligned(val, ptr)
  11.   ({ __typeof__(*(ptr)) __tmp = (val);
  12.      memcpy((ptr), &__tmp, sizeof(*(ptr)));
  13.      (void)0; })
  14. #endif /* _ASM_GENERIC_UNALIGNED_H */