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 
79 #include <yepPredefines.h>
80 #include <stddef.h>
81 
82 #ifdef __DOXYGEN__
83 
89  typedef uint8_t Yep8u;
94  typedef uint16_t Yep16u;
99  typedef uint32_t Yep32u;
104  typedef uint64_t Yep64u;
109  typedef int8_t Yep8s;
114  typedef int16_t Yep16s;
119  typedef int32_t Yep32s;
124  typedef int64_t Yep64s;
130  typedef size_t YepSize;
135  typedef compiler_specific<half> Yep16f;
140  typedef float Yep32f;
145  typedef double Yep64f;
150  typedef compiler_specific<long double> Yep80f;
156  typedef compiler_specific<bool> YepBoolean;
161  #define YepBooleanTrue true
162 
166  #define YepBooleanFalse false
167 
168 #else
169  /* stdint.h types might be unsupported on some compilers, so we use standard C types instead. */
170  typedef unsigned char Yep8u;
171  typedef unsigned short Yep16u;
172  typedef unsigned int Yep32u;
173  typedef unsigned long long Yep64u;
174 
175  typedef signed char Yep8s;
176  typedef signed short Yep16s;
177  typedef signed int Yep32s;
178  typedef signed long long Yep64s;
179 
180  typedef float Yep32f;
181  typedef double Yep64f;
182  #if defined(YEP_X86_CPU) || defined(YEP_X64_CPU)
183  #if defined(YEP_GCC_COMPATIBLE_COMPILER) || (defined(YEP_INTEL_COMPILER_FOR_WINDOWS) && (__LONG_DOUBLE_SIZE__ == 80))
184  #define YEP_COMPILER_SUPPORTS_YEP80F_TYPE
185  typedef long double Yep80f;
186  #endif
187  #endif
188 
189  typedef size_t YepSize;
190 
191  #ifndef __cplusplus
192  #if defined(YEP_MICROSOFT_COMPILER)
193  /* OMG! I can't believe it still doesn't have stdbool.h in 2012! */
194  typedef unsigned char YepBoolean;
195  #define YepBooleanTrue 1
196  #define YepBooleanFalse 0
197  #else
198  #include <stdbool.h>
199  typedef bool YepBoolean;
200  #define YepBooleanTrue true
201  #define YepBooleanFalse false
202  #endif
203  #else
204  typedef bool YepBoolean;
205  const YepBoolean YepBooleanTrue = true;
206  const YepBoolean YepBooleanFalse = false;
207  #endif
208 
209  typedef Yep16u Yep16f;
210 #endif
211 
212 #pragma pack(push, 1)
213 
218 struct Yep16fc {
223 };
224 
229 struct Yep32fc {
234 };
235 
240 struct Yep64fc {
245 };
246 
252 struct Yep32df {
253  Yep32f high;
254  Yep32f low;
255 };
256 
262 struct Yep64df {
263  Yep64f high;
264  Yep64f low;
265 };
266 
267 #if defined(YEP_LITTLE_ENDIAN_BYTE_ORDER) || defined(__DOXYGEN__)
268 
272  typedef struct {
273  Yep64u low;
274  Yep64u high;
275  } Yep128u;
276 
281  typedef struct {
282  Yep64u low;
283  Yep64s high;
284  } Yep128s;
285 #elif defined(YEP_BIG_ENDIAN_BYTE_ORDER)
286  typedef struct {
287  Yep64u high;
288  Yep64u low;
289  } Yep128u;
290 
291  typedef struct {
292  Yep64s high;
293  Yep64u low;
294  } Yep128s;
295 #else
296  #error "Unknown or supported byte order"
297 #endif
298 
299 #pragma pack(pop)
300 
305 enum YepStatus {
330 };