MySQL 8.3.0
Source Code Documentation
my_inttypes.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2016, 2023, Oracle and/or its affiliates.
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#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
43#include <BaseTsd.h>
44typedef unsigned int uint;
45typedef unsigned short ushort;
46#endif
47#if !defined(HAVE_ULONG) && !defined(MYSQL_ABI_CHECK)
48typedef unsigned long ulong; /* Short for unsigned long */
49#endif
50
51typedef unsigned char uchar; /* Short for unsigned char */
52
53// Don't use these in new code; use [u]int64_t.
54typedef long long int longlong;
55typedef 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.
61typedef int8_t int8;
62typedef uint8_t uint8;
63typedef int16_t int16;
64typedef uint16_t uint16;
65typedef int32_t int32;
66typedef uint32_t uint32;
67typedef int64_t int64;
68typedef uint64_t uint64;
69typedef intptr_t intptr;
70
72#define MY_FILEPOS_ERROR (~(my_off_t)0)
73
74#define INT_MIN64 (~0x7FFFFFFFFFFFFFFFLL)
75#define INT_MAX64 0x7FFFFFFFFFFFFFFFLL
76#define INT_MIN32 (~0x7FFFFFFFL)
77#define INT_MAX32 0x7FFFFFFFL
78#define UINT_MAX32 0xFFFFFFFFL
79#define INT_MIN24 (~0x007FFFFF)
80#define INT_MAX24 0x007FFFFF
81#define UINT_MAX24 0x00FFFFFF
82#define INT_MIN16 (~0x7FFF)
83#define INT_MAX16 0x7FFF
84#define UINT_MAX16 0xFFFF
85#define INT_MIN8 (~0x7F)
86#define INT_MAX8 0x7F
87#define UINT_MAX8 0xFF
88
89#ifndef SIZE_T_MAX
90#define SIZE_T_MAX (~((size_t)0))
91#endif
92
93typedef int myf; /* Type of MyFlags in my_funcs */
94
95/* Macros for converting *constants* to the right type */
96#define MYF(v) (myf)(v)
97
98/* Length of decimal number represented by INT32. */
99#define MY_INT32_NUM_DECIMAL_DIGITS 11U
100
101/* Length of decimal number represented by INT64. */
102#define MY_INT64_NUM_DECIMAL_DIGITS 21U
103
104#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
105#ifndef SSIZE_T_DEFINED
106/* krb5/win-mac.h has a conflicting typedef */
107#define SSIZE_T_DEFINED 1
108typedef SSIZE_T ssize_t;
109#endif
110#endif
111
112/*
113 This doesn't really belong here, but it was the only reasonable place
114 at the time.
115*/
116#if defined(_WIN32) && !defined(MYSQL_ABI_CHECK)
117typedef int sigset_t;
118#endif
119
120#endif // MY_INTTYPES_INCLUDED
int myf
Definition: my_inttypes.h:93
unsigned long long int ulonglong
Definition: my_inttypes.h:55
uint8_t uint8
Definition: my_inttypes.h:62
ulonglong my_off_t
Definition: my_inttypes.h:71
unsigned char uchar
Definition: my_inttypes.h:51
intptr_t intptr
Definition: my_inttypes.h:69
int64_t int64
Definition: my_inttypes.h:67
long long int longlong
Definition: my_inttypes.h:54
int16_t int16
Definition: my_inttypes.h:63
int8_t int8
Definition: my_inttypes.h:61
int32_t int32
Definition: my_inttypes.h:65
uint64_t uint64
Definition: my_inttypes.h:68
uint16_t uint16
Definition: my_inttypes.h:64
uint32_t uint32
Definition: my_inttypes.h:66