include/keima_util.h
author David Anderson <dvander@alliedmods.net>
Thu Dec 27 21:07:03 2012 -0800 (2012-12-27)
changeset 246 f9c4371d59d4
parent 198 fb52e868f928
permissions -rw-r--r--
Add support for unary - and bitcast operator.
     1 /* vim: set ts=4 sw=4 tw=99 et:
     2  *
     3  * Copyright (C) 2004-2012 David Anderson
     4  *
     5  * This file is part of SourcePawn.
     6  *
     7  * SourcePawn is free software: you can redistribute it and/or modify it under
     8  * the terms of the GNU General Public License as published by the Free
     9  * Software Foundation, either version 3 of the License, or (at your option)
    10  * any later version.
    11  * 
    12  * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
    13  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    15  *
    16  * You should have received a copy of the GNU General Public License along with
    17  * SourcePawn. If not, see http://www.gnu.org/licenses/.
    18  */
    19 #ifndef _include_keima_util_h_
    20 #define _include_keima_util_h_
    21 
    22 #if defined(_MSC_VER)
    23 # if defined(KE_EXPORTING)
    24 #   define KE_EXPORT __declspec(dllexport)
    25 # elif defined(KE_IMPORTING)
    26 #   define KE_EXPORT __declspec(dllimport)
    27 # endif
    28 #endif
    29 
    30 // 64-bit detection.
    31 #if defined(_M_X64) || defined(__64bit__) || defined(__x86_64__)
    32 # define KE_64BIT
    33 #endif
    34 
    35 // 32-bit detection.
    36 #if defined(_M_IX86) || defined(__i386__)
    37 # if defined KE_64BIT
    38 #  error "Detected 32-bit and 64-bit!"
    39 # endif
    40 # define KE_32BIT
    41 #endif
    42 
    43 #if !defined(KE_32BIT) && !defined(KE_64BIT)
    44 # error "Could not detect CPU type"
    45 #endif
    46 
    47 #if !defined(KE_EXPORT)
    48 # define KE_EXPORT
    49 #endif
    50 
    51 #if defined(_MSC_VER) && _MSC_VER < 1600
    52 typedef __int8 int8_t;
    53 typedef unsigned __int8 uint8_t;
    54 typedef __int16 int16_t;
    55 typedef unsigned __int16 uint16_t;
    56 typedef __int32 int32_t;
    57 typedef unsigned __int32 uint32_t;
    58 typedef __int64 int64_t;
    59 typedef unsigned __int64 uint64_t;
    60 #else
    61 # include <stdint.h>
    62 #endif
    63 
    64 #endif // _include_keima_util_h_