/*---------------------------------------------------------------------------*
  Project:  diskimage tool
  File:     common.h

  Copyright 1998, 1999, 2000 Nintendo.  All rights reserved.

  These coded instructions, statements, and computer programs contain
  proprietary information of Nintendo of America Inc. and/or Nintendo
  Company Ltd., and are protected by Federal copyright law.  They may
  not be disclosed to third parties or copied or duplicated in any form,
  in whole or in part, without the prior written consent of Nintendo.

 *---------------------------------------------------------------------------*/
#ifndef __MASTER_COMMON_H__
#define __MASTER_COMMON_H__

//#ifdef  WIN32
//#include    <winsock2.h>	// Require ws2_32.lib
//#endif
//#define	U32ToBigEndian(x)	htonl(x)
//#define	BigEndianToU32(x)	ntohl(x)

//#define	U32ToBigEndian(x)	htonl(x)
//#define	BigEndianToU32(x)	ntohl(x)
#define U32ToBigEndian(x) ((u32)(( (x & 0xff000000) >> 24)         \
                               + ( (x & 0x00ff0000) >> 8 )         \
                               + ( (x & 0x0000ff00) << 8 )         \
                               + ( (x & 0x000000ff) << 24) ))

#define BigEndianToU32(x) ((u32)(( (x & 0xff000000) >> 24)         \
                              +  ( (x & 0x00ff0000) >> 8 )         \
                              +  ( (x & 0x0000ff00) << 8 )         \
                              +  ( (x & 0x000000ff) << 24) ))


typedef unsigned char	bcd8;

#define	BcdToU8(x)	(((x)>>4)*10+((x)&0x0f))
#define	U8ToBcd(x)	((((x)/10)<<4)+((x)%10))

#define	TRUE		1
#define	FALSE		0

#endif//__MASTER_COMMON_H__

/*===== End of common.h =====*/
