|
沙发

楼主 |
发表于 2009-8-30 23:34:16
|
只看该作者
字节顺序
移植到其他平台时应注意正数字节顺序。存储正数数据时,不同的微处理器在内存中存放最小字节的位置也有所不同。有大端格式(big edian),小端格式(little endian)。
相关头文件位置(对于ARM平台):
arch/arm/include/asm/byteorder.h
其内容为:
/*
* arch/arm/include/asm/byteorder.h
*
* ARM Endian-ness. In little endian mode, the data bus is connected such
* that byte accesses appear as:
* 0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31
* and word accesses (data or instruction) appear as:
* d0...d31
*
* When in big endian mode, byte accesses appear as:
* 0 = d24...d31, 1 = d16...d23, 2 = d8...d15, 3 = d0...d7
* and word accesses (data or instruction) appear as:
* d0...d31
*/
#ifndef __ASM_ARM_BYTEORDER_H
#define __ASM_ARM_BYTEORDER_H
#ifdef __ARMEB__
#include <linux/byteorder/big_endian.h> /*大端格式处理*/
#else
#include <linux/byteorder/little_endian.h> /*小端格式处理*/
#endif
#endif |
|