Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tnz4.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
short swap_short(short s) {
Shinya Kitaoka 120a6e
  s = ((s >> 8) & 0x00ff) | (s << 8);
Shinya Kitaoka 120a6e
  return s;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TINT32 swap_TINT32(TINT32 s) {
Shinya Kitaoka 120a6e
  TINT32 appo, aux, aux1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  appo = 0xff0000ff;
Shinya Kitaoka 120a6e
  aux  = (s & appo);
Shinya Kitaoka 120a6e
  aux1 = (aux >> 24) & 0x000000ff;
Shinya Kitaoka 120a6e
  aux  = (aux << 24) | aux1;
Shinya Kitaoka 120a6e
  appo = 0x00ffff00;
Shinya Kitaoka 120a6e
  aux1 = (s & appo);
Shinya Kitaoka 120a6e
  aux1 = ((aux1 >> 8) | (aux1 << 8)) & appo;
Shinya Kitaoka 120a6e
  aux  = (aux | aux1);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return aux;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
USHORT swap_ushort(USHORT x) { return x >> 8 | x << 8; }
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
*/