//	ＡＩＧライブラリ　型定義
//		Copyright (C) 1993-94,98 by AIG-SOFT

#ifndef	__DEFTYPE1__
#define __DEFTYPE1__	1

#include "cdecl.h"

/* 型宣言 */
typedef unsigned char		unchar;
typedef unsigned int		unint;
typedef unsigned short int	unsint;
typedef unsigned long		unlong;	/* = unint in X68 */

#define	unshort	unsint
#define	sint	short

/* その型のサイズ */
#define	LLLONG	(sizeof(long long))
#define	LLONG	(sizeof(long))
#define	LINT	(sizeof(int))
#define	LSHORT	(sizeof(short))
#define	LCHAR	(sizeof(char))
#define	LCPOINT	(sizeof(unchar *))

/* その型のもつビット数 */
#define	BLLONG	(LLLONG*8)
#define	BLONG	(LLONG*8)
#define	BINT	(LINT*8)
#define	BSHORT	(LSHORT*8)
#define	BCHAR	(LCHAR*8)

#include <stddef.h>

/* 超基本関数定義 */
#define	alloca(sz)	__builtin_alloca(sz)

#define _rotr(v1,v2)			\
	({register int _D0 asm("d0");	\
	  register int _D1 asm("d1");	\
	_D1=(v2);			\
	_D0=(v1);			\
	asm volatile ("ror.l d1,d0"	\
		:"=d"(_D0)		\
		:"0"(_D0),"d"(_D1)	\
		:"d0","d1");		\
	_D0;				\
	})
#define _rotl(v1,v2)			\
	({register int _D0 asm("d0");	\
	  register int _D1 asm("d1");	\
	_D1=(v2);			\
	_D0=(v1);			\
	asm volatile ("rol.l d1,d0"	\
		:"=d"(_D0)		\
		:"0"(_D0),"d"(_D1)	\
		:"d0","d1");		\
	_D0;				\
	})
#define _rotrW(v1,v2)			\
	({register int _D0 asm("d0");	\
	  register int _D1 asm("d1");	\
	_D1=(v2);			\
	_D0=(v1);			\
	asm volatile ("ror.w d1,d0"	\
		:"=d"(_D0)		\
		:"0"(_D0),"d"(_D1)	\
		:"d0","d1");		\
	_D0;				\
	})
#define _rotlW(v1,v2)			\
	({register int _D0 asm("d0");	\
	  register int _D1 asm("d1");	\
	_D1=(v2);			\
	_D0=(v1);			\
	asm volatile ("rol.w d1,d0"	\
		:"=d"(_D0)		\
		:"0"(_D0),"d"(_D1)	\
		:"d0","d1");		\
	_D0;				\
	})

#endif
