aboutsummaryrefslogtreecommitdiff
path: root/include/bh/platform.h
blob: f80efda6f7398fc4f0f690d2384278dd869dd9be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef BH_PLATFORM_H
#define BH_PLATFORM_H

#include <stddef.h>

/* Common type definitions */
typedef signed char         bh_int8_t;
typedef unsigned char       bh_uint8_t;
typedef signed short        bh_int16_t;
typedef unsigned short      bh_uint16_t;
typedef float               bh_float32_t;
typedef double              bh_float64_t;

/* Platform specific type definition */
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__)
#include <stdint.h>

typedef int32_t             bh_int32_t;
typedef uint32_t            bh_uint32_t;
typedef int64_t             bh_int64_t;
typedef uint64_t            bh_uint64_t;
typedef intptr_t            bh_intptr_t;
typedef uintptr_t           bh_uintptr_t;

#elif defined(_WIN32)
typedef __int32             bh_int32_t;
typedef unsigned __int32    bh_uint32_t;
typedef __int64             bh_int64_t;
typedef unsigned __int64    bh_uint64_t;

#if defined(_WIN64)
typedef __int64             bh_intptr_t;
typedef unsigned __int64    bh_uintptr_t;
#else
typedef __int32             bh_intptr_t;
typedef unsigned __int32    bh_uintptr_t;
#endif

#else

#error "Unsupported platform"
#endif

typedef bh_int64_t          bh_off_t;

#endif /* BH_PLATFORM_H */