/* vim: set ts=4 sw=4 tw=99 et:
 *
 * Copyright (C) 2004-2012 David Anderson
 *
 * This file is part of SourcePawn.
 *
 * SourcePawn 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 3 of the License, or (at your option)
 * any later version.
 * 
 * SourcePawn 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
 * SourcePawn. If not, see http://www.gnu.org/licenses/.
 */
#ifndef _include_keima_util_h_
#define _include_keima_util_h_

#if defined(_MSC_VER)
# if defined(KE_EXPORTING)
#   define KE_EXPORT __declspec(dllexport)
# elif defined(KE_IMPORTING)
#   define KE_EXPORT __declspec(dllimport)
# endif
#endif

// 64-bit detection.
#if defined(_M_X64) || defined(__64bit__) || defined(__x86_64__)
# define KE_64BIT
#endif

// 32-bit detection.
#if defined(_M_IX86) || defined(__i386__)
# if defined KE_64BIT
#  error "Detected 32-bit and 64-bit!"
# endif
# define KE_32BIT
#endif

#if !defined(KE_32BIT) && !defined(KE_64BIT)
# error "Could not detect CPU type"
#endif

#if !defined(KE_EXPORT)
# define KE_EXPORT
#endif

#if defined(_MSC_VER) && _MSC_VER < 1600
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
# include <stdint.h>
#endif

#endif // _include_keima_util_h_
