Code_TYMPAN  4.4.0
Industrial site acoustic simulation
defines.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef TY_C_DEFINES
17 #define TY_C_DEFINES
18 
19 /*
20  Initial platform/compiler-related stuff to set.
21  */
22 #define TY_PLATFORM_WIN32 1
23 #define TY_PLATFORM_WIN64 2
24 #define TY_PLATFORM_LINUX 3
25 
26 #define TY_COMPILER_MSVC 1
27 #define TY_COMPILER_GNUC 2
28 
29 #define TY_ARCHITECTURE_32 1
30 #define TY_ARCHITECTURE_64 2
31 
32 /* Finds the compiler type and version.
33  */
34 #if defined(_MSC_VER)
35  #define TY_COMPILER TY_COMPILER_MSVC
36  #define TY_COMP_VER _MSC_VER
37 
38 #elif defined(__GNUC__)
39  #define TY_COMPILER TY_COMPILER_GNUC
40  #define TY_COMP_VER (((__GNUC__)*100) + (__GNUC_MINOR__ * 10) + __GNUC_PATCHLEVEL__)
41 
42 #else
43  #pragma error "No known compiler. Abort! Abort!"
44 
45 #endif
46 
47 /* Finds the current platform */
48 #if defined(_WIN64_) || defined(_WIN64)
49  #define TY_PLATFORM TY_PLATFORM_WIN64
50 
51 #elif defined(__WIN32__) || defined(_WIN32)
52  #define TY_PLATFORM TY_PLATFORM_WIN32
53 
54 #else
55  #define TY_PLATFORM TY_PLATFORM_LINUX
56 #endif
57 
58 /* Find the arch type */
59 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || \
60  defined(__ia64__) || defined(__s390__) || defined(__s390x__)
61  #define TY_ARCH_TYPE TY_ARCHITECTURE_64
62 #else
63  #define TY_ARCH_TYPE TY_ARCHITECTURE_32
64 #endif
65 
66 #if TY_ARCH_TYPE == TY_ARCHITECTURE_32
67  #define TY_PRODUCT_PLATFORM_ "32bits"
68 #else
69  #define TY_PRODUCT_PLATFORM_ "64bits"
70 #endif
71 
72 // Integer formats of fixed bit width
73 typedef unsigned char uint8;
74 typedef unsigned short uint16;
75 typedef unsigned int uint32;
76 // define uint64 type
77 #if TY_COMPILER == TY_COMPILER_MSVC
78 typedef unsigned __int64 uint64;
79 #else
80 typedef unsigned long long uint64;
81 #endif
82 
83 #endif // TY_C_DEFINES
unsigned short uint16
Definition: defines.h:74
unsigned int uint32
Definition: defines.h:75
unsigned long long uint64
Definition: defines.h:80
unsigned char uint8
Definition: defines.h:73