MySQL  8.0.18
Source Code Documentation
my_inttypes.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2016, 2019, 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, version 2.0,
6  as published by the Free Software Foundation.
7 
8  This program is also distributed with certain software (including
9  but not limited to OpenSSL) that is licensed under separate terms,
10  as designated in a particular file or component or in included license
11  documentation. The authors of MySQL hereby grant you an additional
12  permission to link the program and your derivative works with the
13  separately licensed software that they have included with MySQL.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License, version 2.0, for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23 
24 #ifndef MY_INTTYPES_INCLUDED
25 #define MY_INTTYPES_INCLUDED
26 
27 /**
28  @file include/my_inttypes.h
29  Some integer typedefs for easier portability.
30 
31  @deprecated Use <stdint.h> instead. Prefer int to sized types.
32 */
33 
34 #include "my_config.h"
35 
36 #ifndef MYSQL_ABI_CHECK
37 #include <stddef.h>
38 #include <stdint.h>
39 #include <sys/types.h>
40 #endif
41 
42 #ifdef _WIN32
43 #include <BaseTsd.h>
44 typedef unsigned int uint;
45 typedef unsigned short ushort;
46 #endif
47 #if !defined(HAVE_ULONG)
48 typedef unsigned long ulong; /* Short for unsigned long */
49 #endif
50 
51 typedef unsigned char uchar; /* Short for unsigned char */
52 
53 // Don't use these in new code; use [u]int64_t.
54 typedef long long int longlong;
55 typedef unsigned long long int ulonglong;
56 
57 // Legacy typedefs. Prefer the standard intXX_t (or std::intXX_t) to these.
58 // Note that the Google C++ style guide says you should generally not use
59 // unsigned types unless you need defined wraparound semantics or store
60 // things like bitfields. Your default choice of type should be simply int.
61 typedef int8_t int8;
62 typedef uint8_t uint8;
63 typedef int16_t int16;
64 typedef uint16_t uint16;
65 typedef int32_t int32;
66 typedef uint32_t uint32;
67 typedef int64_t int64;
68 typedef uint64_t uint64;
69 typedef intptr_t intptr;
70 
71 #if defined(_WIN32)
72 typedef unsigned long long my_off_t;
73 #else
74 #if SIZEOF_OFF_T > 4
75 typedef ulonglong my_off_t;
76 #else
77 typedef unsigned long my_off_t;
78 #endif
79 #endif /*_WIN32*/
80 #define MY_FILEPOS_ERROR (~(my_off_t)0)
81 
82 #if defined(_WIN32)
83 /*
84  off_t is 32 bit long. We do not use C runtime functions
85  with off_t but native Win32 file IO APIs, that work with
86  64 bit offsets.
87 */
88 #undef SIZEOF_OFF_T
89 #define SIZEOF_OFF_T 8
90 #endif
91 
92 #define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
93 #define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
94 #define INT_MIN32 (~0x7FFFFFFFL)
95 #define INT_MAX32 0x7FFFFFFFL
96 #define UINT_MAX32 0xFFFFFFFFL
97 #define INT_MIN24 (~0x007FFFFF)
98 #define INT_MAX24 0x007FFFFF
99 #define UINT_MAX24 0x00FFFFFF
100 #define INT_MIN16 (~0x7FFF)
101 #define INT_MAX16 0x7FFF
102 #define UINT_MAX16 0xFFFF
103 #define INT_MIN8 (~0x7F)
104 #define INT_MAX8 0x7F
105 #define UINT_MAX8 0xFF
106 
107 #ifndef SIZE_T_MAX
108 #define SIZE_T_MAX (~((size_t)0))
109 #endif
110 
111 typedef int myf; /* Type of MyFlags in my_funcs */
112 
113 /* Macros for converting *constants* to the right type */
114 #define MYF(v) (myf)(v)
115 
116 /* Length of decimal number represented by INT32. */
117 #define MY_INT32_NUM_DECIMAL_DIGITS 11U
118 
119 /* Length of decimal number represented by INT64. */
120 #define MY_INT64_NUM_DECIMAL_DIGITS 21U
121 
122 #ifdef _WIN32
123 typedef SSIZE_T ssize_t;
124 #endif
125 
126 /*
127  This doesn't really belong here, but it was the only reasonable place
128  at the time.
129 */
130 #ifdef _WIN32
131 typedef int sigset_t;
132 #endif
133 
134 #endif // MY_INTTYPES_INCLUDED
unsigned long long int ulonglong
Definition: my_inttypes.h:55
unsigned char uchar
Definition: my_inttypes.h:51
int64_t int64
Definition: my_inttypes.h:67
uint16_t uint16
Definition: my_inttypes.h:64
unsigned int uint
Definition: uca-dump.cc:29
long long int longlong
Definition: my_inttypes.h:54
uint32_t uint32
Definition: my_inttypes.h:66
uint8_t uint8
Definition: my_inttypes.h:62
unsigned long my_off_t
Definition: my_inttypes.h:77
int myf
Definition: my_inttypes.h:111
int32_t int32
Definition: my_inttypes.h:65
intptr_t intptr
Definition: my_inttypes.h:69
int8_t int8
Definition: my_inttypes.h:61
unsigned long ulong
Definition: my_inttypes.h:48
int16_t int16
Definition: my_inttypes.h:63
uint64_t uint64
Definition: my_inttypes.h:68