MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mystdint.h
1 /*
2  Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program 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; version 2 of the License.
7 
8  This program 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. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 /*
18  * mystdint.h
19  */
20 
21 #ifndef mystdint_h
22 #define mystdint_h
23 
24 /*
25  * Definition of C99's exact-width integral types for JTie.
26  *
27  * JTie has pre-defined type mappings for the C99 exact-width type aliases:
28  * int8_t, uint8_t, ... int64_t, uint64_t, which are a more natural fit for
29  * Java than the native, integral C types, char ... long long,
30  *
31  * Unfortunately, the C99 <stdint.h> file is not provided by some C/C++
32  * compilers. (It's a crying shame. For instance, MS Visual Studio
33  * provides <stdint.h> not until VS2010.) Therefore, this header deals in a
34  * single place with the presence or absence of the <stdint.h> file.
35  *
36  * While JTie applications (like NDB JTie) may have their own type aliases
37  * for exact-width types, it is preferrable not use these as the basis for
38  * JTie's implementation and tests itself -- for platform testing has proven
39  * much easier with a self-contained, standalone-compilable and -testable
40  * JTie unit tests, where problematic patterns can be readily identified.
41  * Hence, applications with their own, non-stdint-based exact-width type
42  * definitions should add and use corresponding JTie type mapping aliases.
43  */
44 
45 #include <ndb_global.h>
46 
47 #ifdef HAVE_STDINT_H
48 
49 #include <stdint.h> // not using namespaces yet
50 
51 #else
52 
53 // this covers ILP32 and LP64 programming models
54 #ifndef __SunOS_5_9
55 typedef signed char int8_t;
56 typedef signed long int32_t;
57 typedef unsigned long uint32_t;
58 typedef signed long long int64_t;
59 typedef unsigned long long uint64_t;
60 #endif
61 typedef unsigned char uint8_t;
62 typedef signed short int16_t;
63 typedef unsigned short uint16_t;
64 
65 #endif // !HAVE_STDINT_H
66 
67 #endif // mystdint_h
68