Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tnz4.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
short swap_short(short s)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	s = ((s >> 8) & 0x00ff) | (s << 8);
Toshihiro Shimizu 890ddd
	return s;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TINT32 swap_TINT32(TINT32 s)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TINT32 appo, aux, aux1;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	appo = 0xff0000ff;
Toshihiro Shimizu 890ddd
	aux = (s & appo);
Toshihiro Shimizu 890ddd
	aux1 = (aux >> 24) & 0x000000ff;
Toshihiro Shimizu 890ddd
	aux = (aux << 24) | aux1;
Toshihiro Shimizu 890ddd
	appo = 0x00ffff00;
Toshihiro Shimizu 890ddd
	aux1 = (s & appo);
Toshihiro Shimizu 890ddd
	aux1 = ((aux1 >> 8) | (aux1 << 8)) & appo;
Toshihiro Shimizu 890ddd
	aux = (aux | aux1);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	return aux;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
USHORT swap_ushort(USHORT x)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	return x >> 8 | x << 8;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
ULONG swap_uTINT32 (ULONG x)
Toshihiro Shimizu 890ddd
{ return x >> 24 | (x & 0xff0000) >> 8 | (x & 0xff00) << 8 | x << 24; }
Toshihiro Shimizu 890ddd
*/