Yeppp!
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
yepTypes.h
1 /*
2  * Yeppp! library header
3  *
4  * This file is part of Yeppp! library and licensed under the New BSD license.
5  *
6  * Copyright (C) 2010-2012 Marat Dukhan
7  * Copyright (C) 2012-2013 Georgia Institute of Technology
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the Georgia Institute of Technology nor the
18  * names of its contributors may be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #pragma once
34 
37 #include <yepPredefines.h>
38 #include <stddef.h>
39 
40 #ifdef YEP_MICROSOFT_COMPILER
41  /* stdint.h is not supported before Visual Studio 2010 */
42  typedef unsigned __int8 Yep8u;
43  typedef unsigned __int16 Yep16u;
44  typedef unsigned __int32 Yep32u;
45  typedef unsigned __int64 Yep64u;
46 
47  typedef signed __int8 Yep8s;
48  typedef signed __int16 Yep16s;
49  typedef signed __int32 Yep32s;
50  typedef signed __int64 Yep64s;
51 
52 #else
53  #include <stdint.h>
54 
61  typedef uint8_t Yep8u;
66  typedef uint16_t Yep16u;
71  typedef uint32_t Yep32u;
76  typedef uint64_t Yep64u;
81  typedef int8_t Yep8s;
86  typedef int16_t Yep16s;
91  typedef int32_t Yep32s;
96  typedef int64_t Yep64s;
97 #endif
98 
103 typedef size_t YepSize;
104 
105 #ifdef __DOXYGEN__
106 
110  typedef compiler_specific<half> Yep16f;
111 #else
112  typedef Yep16u Yep16f;
113 #endif
114 
118 typedef float Yep32f;
123 typedef double Yep64f;
124 #ifdef __DOXYGEN__
125 
129  typedef compiler_specific<long double> Yep80f;
130 #else
131  #if defined(YEP_X86_CPU)
132  #if defined(YEP_GCC_COMPATIBLE_COMPILER) || (defined(YEP_INTEL_COMPILER_FOR_WINDOWS) && (__LONG_DOUBLE_SIZE__ == 80))
133  #define YEP_COMPILER_SUPPORTS_YEP80F_TYPE
134  typedef long double Yep80f;
135  #endif
136  #endif
137 #endif
138 
139 #ifdef __DOXYGEN__
140 
145  typedef compiler_specific<bool> YepBoolean;
150  #define YepBooleanTrue true
151 
155  #define YepBooleanFalse false
156 
157 #else
158  #ifndef __cplusplus
159  #if defined(YEP_MICROSOFT_COMPILER)
160  typedef unsigned __int8 YepBoolean;
161  #define YepBooleanTrue 1
162  #define YepBooleanFalse 0
163  #else
164  #include <stdbool.h>
165  typedef bool YepBoolean;
166  #define YepBooleanTrue true
167  #define YepBooleanFalse false
168  #endif
169  #else
170  typedef bool YepBoolean;
171  const YepBoolean YepBooleanTrue = true;
172  const YepBoolean YepBooleanFalse = false;
173  #endif
174 #endif
175 
176 #pragma pack(push, 1)
177 
182 typedef struct {
187 } Yep16fc;
188 
193 typedef struct {
198 } Yep32fc;
199 
204 typedef struct {
209 } Yep64fc;
210 
216 typedef struct {
217  Yep32f high;
218  Yep32f low;
219 } Yep32df;
220 
226 typedef struct {
227  Yep64f high;
228  Yep64f low;
229 } Yep64df;
230 
231 #if defined(YEP_LITTLE_ENDIAN_BYTE_ORDER) || defined(__DOXYGEN__)
232 
236  typedef struct {
237  Yep64u low;
238  Yep64u high;
239  } Yep128u;
240 
245  typedef struct {
246  Yep64u low;
247  Yep64s high;
248  } Yep128s;
249 #elif defined(YEP_BIG_ENDIAN_BYTE_ORDER)
250  typedef struct {
251  Yep64u high;
252  Yep64u low;
253  } Yep128u;
254 
255  typedef struct {
256  Yep64s high;
257  Yep64u low;
258  } Yep128s;
259 #else
260  #error "Unknown or unsupported byte order"
261 #endif
262 
263 #pragma pack(pop)
264 
269 enum YepStatus {
294 };