MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
byte_order_generic_x86_64.h
1
/* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
2
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15
16
/*
17
Optimized function-like macros for the x86 architecture (_WIN32 included).
18
*/
19
#define sint2korr(A) (int16) (*((int16 *) (A)))
20
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
21
(((uint32) 255L << 24) | \
22
(((uint32) (uchar) (A)[2]) << 16) |\
23
(((uint32) (uchar) (A)[1]) << 8) | \
24
((uint32) (uchar) (A)[0])) : \
25
(((uint32) (uchar) (A)[2]) << 16) |\
26
(((uint32) (uchar) (A)[1]) << 8) | \
27
((uint32) (uchar) (A)[0])))
28
#define sint4korr(A) (int32) (*((int32 *) (A)))
29
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
30
/*
31
Attention: Please, note, uint3korr reads 4 bytes (not 3)!
32
It means, that you have to provide enough allocated space.
33
*/
34
#if defined(HAVE_purify) && !defined(_WIN32)
35
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
36
(((uint32) ((uchar) (A)[1])) << 8) +\
37
(((uint32) ((uchar) (A)[2])) << 16))
38
#else
39
#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF)
40
#endif
41
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
42
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
43
(((uint32) ((uchar) (A)[1])) << 8) +\
44
(((uint32) ((uchar) (A)[2])) << 16) +\
45
(((uint32) ((uchar) (A)[3])) << 24)) +\
46
(((ulonglong) ((uchar) (A)[4])) << 32))
47
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
48
(((uint32) ((uchar) (A)[1])) << 8) + \
49
(((uint32) ((uchar) (A)[2])) << 16) + \
50
(((uint32) ((uchar) (A)[3])) << 24)) + \
51
(((ulonglong) ((uchar) (A)[4])) << 32) + \
52
(((ulonglong) ((uchar) (A)[5])) << 40))
53
#define uint8korr(A) (ulonglong) (*((ulonglong *) (A)))
54
#define sint8korr(A) (longlong) (*((longlong *) (A)))
55
56
#define int2store(T,A) do { uchar *pT= (uchar*)(T);\
57
*((uint16*)(pT))= (uint16) (A);\
58
} while (0)
59
60
#define int3store(T,A) do { *(T)= (uchar) ((A));\
61
*(T+1)=(uchar) (((uint) (A) >> 8));\
62
*(T+2)=(uchar) (((A) >> 16));\
63
} while (0)
64
#define int4store(T,A) do { uchar *pT= (uchar*)(T);\
65
*((uint32 *) (pT))= (uint32) (A); \
66
} while (0)
67
68
#define int5store(T,A) do { *(T)= (uchar)((A));\
69
*((T)+1)=(uchar) (((A) >> 8));\
70
*((T)+2)=(uchar) (((A) >> 16));\
71
*((T)+3)=(uchar) (((A) >> 24));\
72
*((T)+4)=(uchar) (((A) >> 32));\
73
} while(0)
74
#define int6store(T,A) do { *(T)= (uchar)((A)); \
75
*((T)+1)=(uchar) (((A) >> 8)); \
76
*((T)+2)=(uchar) (((A) >> 16)); \
77
*((T)+3)=(uchar) (((A) >> 24)); \
78
*((T)+4)=(uchar) (((A) >> 32)); \
79
*((T)+5)=(uchar) (((A) >> 40)); \
80
} while(0)
81
#define int8store(T,A) do { uchar *pT= (uchar*)(T);\
82
*((ulonglong *) (pT))= (ulonglong) (A);\
83
} while(0)
84
include
byte_order_generic_x86_64.h
Generated on Sat Nov 9 2013 01:24:44 for MySQL 5.6.14 Source Code Document by
1.8.1.2