2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
#include "tnz4.h"
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
short swap_short(short s) {
|
|
|
|
s = ((s >> 8) & 0x00ff) | (s << 8);
|
|
|
|
return s;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TINT32 swap_TINT32(TINT32 s) {
|
|
|
|
TINT32 appo, aux, aux1;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
appo = 0xff0000ff;
|
|
|
|
aux = (s & appo);
|
|
|
|
aux1 = (aux >> 24) & 0x000000ff;
|
|
|
|
aux = (aux << 24) | aux1;
|
|
|
|
appo = 0x00ffff00;
|
|
|
|
aux1 = (s & appo);
|
|
|
|
aux1 = ((aux1 >> 8) | (aux1 << 8)) & appo;
|
|
|
|
aux = (aux | aux1);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
return aux;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
USHORT swap_ushort(USHORT x) { return x >> 8 | x << 8; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*
|
|
|
|
ULONG swap_uTINT32 (ULONG x)
|
|
|
|
{ return x >> 24 | (x & 0xff0000) >> 8 | (x & 0xff00) << 8 | x << 24; }
|
|
|
|
*/
|