[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

architectures, endianness



Hi all,

Do we have a table/chart somewhere that explains which
Architectures use which endianness?  Gpart has incomplete
support for endianness, the beginnings of which are
implemented as shown below; it behaves as if only i386 
and alpha are little-endian --is that true? 

Thanks.

/*
 * endianness (incomplete, later)
 */

#if defined(__i386__) || defined(__alpha__)
#	define le16(x)	(x)		/* x as little endian */
#	define be16(x)	(((x)&0xff00)>>8)			| \
			(((x)&0x00ff)<<8)
#	define le32(x)	(x)
#	define be32(x)	(((x)&0xff000000L)>>24)			| \
			(((x)&0x00ff0000L)>>8)			| \
			(((x)&0x0000ff00L)<<8)			| \
			(((x)&0x000000ffL)<<24)
#	define le64(x)	(x)
#	define be64(x)	(((x)&0xff00000000000000LL)>>56)	| \
			(((x)&0x00ff000000000000LL)>>40)	| \
			(((x)&0x0000ff0000000000LL)>>24)	| \
			(((x)&0x000000ff00000000LL)>>8)		| \
			(((x)&0x00000000ff000000LL)<<8)		| \
			(((x)&0x0000000000ff0000LL)<<24)	| \
			(((x)&0x000000000000ff00LL)<<40)	| \
			(((x)&0x00000000000000ffLL)<<56)
#else /* bigendian */
#	define le16(x)	(((x)&0xff00)>>8)			| \
			(((x)&0x00ff)<<8)
#	define be16(x)	(x)
#	define le32(x)	(((x)&0xff000000L)>>24)			| \
			(((x)&0x00ff0000L)>>8)			| \
			(((x)&0x0000ff00L)<<8)			| \
			(((x)&0x000000ffL)<<24)
#	define be32(x)	(x)
#	define le64(x)	(((x)&0xff00000000000000LL)>>56)	| \
			(((x)&0x00ff000000000000LL)>>40)	| \
			(((x)&0x0000ff0000000000LL)>>24)	| \
			(((x)&0x000000ff00000000LL)>>8)		| \
			(((x)&0x00000000ff000000LL)<<8)		| \
			(((x)&0x0000000000ff0000LL)<<24)	| \
			(((x)&0x000000000000ff00LL)<<40)	| \
			(((x)&0x00000000000000ffLL)<<56)
#	define be64(x)	(x)
#endif













Reply to: