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