/*
 *  smoke16/include/types.h - Defines uX and sX types.
 *  $Revision: 1.7 $
 *  Copyright 1997, Benjamin Sittler
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

/* DEBUG_64_ONLY
 *
 * Define this if you want the toolchain to use the GCC 'long long'
 * types (which are usually 64 bits wide) to store 8-bit, 16-bit and
 * 32-bit SMOKE-16 quantities.
 *
 * FIXME: Unsigned 8-bit SMOKE-16 quantities ('u8') are unaffected by
 *        DEBUG_64_ONLY because doing so would break the emulator.
 *        (See the FIXME comment below for more details.)
 */
/* #define DEBUG_64_ONLY */

#ifndef SMOKE16__TYPES_H_INCLUDED
#define SMOKE16__TYPES_H_INCLUDED

/* these types need to be at least 8 bits wide */

/*
 * FIXME: Some parts of the emulator (system calls, for example) still
 *        assume that 'u8' is the same size as 'char'. The rest of the
 *        toolchain should work fine with larger-than-necessary types.
 */

#if 1 /* FIXME: should be #ifndef DEBUG_64_ONLY */
typedef unsigned char u8;
#define FMT_u8 "u"
#define FMT_x8 "x"
#define FMT_X8 "X"
#define FMT_o8 "o"
#else
typedef unsigned long long u8;
#define FMT_u8 "llu"
#define FMT_x8 "llx"
#define FMT_X8 "llX"
#define FMT_o8 "llo"
#endif

#ifndef DEBUG_64_ONLY
typedef signed char s8;
#define FMT_s8 "d"
#else
typedef signed long long s8;
#define FMT_s8 "lld"
#endif

/* these types need to be at least 16 bits wide */

#ifndef DEBUG_64_ONLY
typedef unsigned short u16;
#define FMT_u16 "hu"
#define FMT_x16 "hx"
#define FMT_X16 "hX"
#define FMT_o16 "ho"
#else
typedef unsigned long long u16;
#define FMT_u16 "llu"
#define FMT_x16 "llx"
#define FMT_X16 "llX"
#define FMT_o16 "llo"
#endif

#ifndef DEBUG_64_ONLY
typedef signed short s16;
#define FMT_s16 "hd"
#else
typedef signed long long s16;
#define FMT_s16 "lld"
#endif

/* these types need to be at least 32 bits wide */

#ifndef DEBUG_64_ONLY
typedef unsigned long u32;
#define FMT_u32 "lu"
#define FMT_x32 "lx"
#define FMT_X32 "lX"
#define FMT_o32 "lo"
#else
typedef unsigned long long u32;
#define FMT_u32 "llu"
#define FMT_x32 "llx"
#define FMT_X32 "llX"
#define FMT_o32 "llo"
#endif

#ifndef DEBUG_64_ONLY
typedef signed long s32;
#define FMT_s32 "ld"
#else
typedef signed long long s32;
#define FMT_s32 "lld"
#endif

#endif /* SMOKE16__TYPES_H_INCLUDED */
