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.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
Endianness-independent definitions for architectures other
18
than the x86 architecture.
19
*/
20
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
21
((int16) ((int16) (A)[1]) << 8))
22
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
23
(((uint32) 255L << 24) | \
24
(((uint32) (uchar) (A)[2]) << 16) |\
25
(((uint32) (uchar) (A)[1]) << 8) | \
26
((uint32) (uchar) (A)[0])) : \
27
(((uint32) (uchar) (A)[2]) << 16) |\
28
(((uint32) (uchar) (A)[1]) << 8) | \
29
((uint32) (uchar) (A)[0])))
30
#define sint4korr(A) (int32) (((int32) ((uchar) (A)[0])) +\
31
(((int32) ((uchar) (A)[1]) << 8)) +\
32
(((int32) ((uchar) (A)[2]) << 16)) +\
33
(((int32) ((int16) (A)[3]) << 24)))
34
#define sint8korr(A) (longlong) uint8korr(A)
35
#define uint2korr(A) (uint16) (((uint16) ((uchar) (A)[0])) +\
36
((uint16) ((uchar) (A)[1]) << 8))
37
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
38
(((uint32) ((uchar) (A)[1])) << 8) +\
39
(((uint32) ((uchar) (A)[2])) << 16))
40
#define uint4korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
41
(((uint32) ((uchar) (A)[1])) << 8) +\
42
(((uint32) ((uchar) (A)[2])) << 16) +\
43
(((uint32) ((uchar) (A)[3])) << 24))
44
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
45
(((uint32) ((uchar) (A)[1])) << 8) +\
46
(((uint32) ((uchar) (A)[2])) << 16) +\
47
(((uint32) ((uchar) (A)[3])) << 24)) +\
48
(((ulonglong) ((uchar) (A)[4])) << 32))
49
#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \
50
(((uint32) ((uchar) (A)[1])) << 8) + \
51
(((uint32) ((uchar) (A)[2])) << 16) + \
52
(((uint32) ((uchar) (A)[3])) << 24)) + \
53
(((ulonglong) ((uchar) (A)[4])) << 32) + \
54
(((ulonglong) ((uchar) (A)[5])) << 40))
55
#define uint8korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
56
(((uint32) ((uchar) (A)[1])) << 8) +\
57
(((uint32) ((uchar) (A)[2])) << 16) +\
58
(((uint32) ((uchar) (A)[3])) << 24)) +\
59
(((ulonglong) (((uint32) ((uchar) (A)[4])) +\
60
(((uint32) ((uchar) (A)[5])) << 8) +\
61
(((uint32) ((uchar) (A)[6])) << 16) +\
62
(((uint32) ((uchar) (A)[7])) << 24))) <<\
63
32))
64
#define int2store(T,A) do { uint def_temp= (uint) (A) ;\
65
*((uchar*) (T))= (uchar)(def_temp); \
66
*((uchar*) (T)+1)=(uchar)((def_temp >> 8)); \
67
} while(0)
68
#define int3store(T,A) do {
/*lint -save -e734 */
\
69
*((uchar*)(T))=(uchar) ((A));\
70
*((uchar*) (T)+1)=(uchar) (((A) >> 8));\
71
*((uchar*)(T)+2)=(uchar) (((A) >> 16)); \
72
/*lint -restore */
} while(0)
73
#define int4store(T,A) do { *((char *)(T))=(char) ((A));\
74
*(((char *)(T))+1)=(char) (((A) >> 8));\
75
*(((char *)(T))+2)=(char) (((A) >> 16));\
76
*(((char *)(T))+3)=(char) (((A) >> 24));\
77
} while(0)
78
#define int5store(T,A) do { *((char *)(T))= (char)((A)); \
79
*(((char *)(T))+1)= (char)(((A) >> 8)); \
80
*(((char *)(T))+2)= (char)(((A) >> 16)); \
81
*(((char *)(T))+3)= (char)(((A) >> 24)); \
82
*(((char *)(T))+4)= (char)(((A) >> 32)); \
83
} while(0)
84
#define int6store(T,A) do { *((char *)(T))= (char)((A)); \
85
*(((char *)(T))+1)= (char)(((A) >> 8)); \
86
*(((char *)(T))+2)= (char)(((A) >> 16)); \
87
*(((char *)(T))+3)= (char)(((A) >> 24)); \
88
*(((char *)(T))+4)= (char)(((A) >> 32)); \
89
*(((char *)(T))+5)= (char)(((A) >> 40)); \
90
} while(0)
91
#define int8store(T,A) do { uint def_temp= (uint) (A), \
92
def_temp2= (uint) ((A) >> 32); \
93
int4store((T),def_temp); \
94
int4store((T+4),def_temp2);\
95
} while(0)
include
byte_order_generic.h
Generated on Sat Nov 9 2013 01:24:44 for MySQL 5.6.14 Source Code Document by
1.8.1.2