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
myisampack.h
1
#ifndef MYISAMPACK_INCLUDED
2
#define MYISAMPACK_INCLUDED
3
4
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
5
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; version 2 of the License.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
19
/*
20
Storing of values in high byte first order.
21
22
integer keys and file pointers are stored with high byte first to get
23
better compression
24
*/
25
26
/* these two are for uniformity */
27
#define mi_sint1korr(A) ((int8)(*A))
28
#define mi_uint1korr(A) ((uint8)(*A))
29
30
#define mi_sint2korr(A) ((int16) (((int16) (((uchar*) (A))[1])) +\
31
((int16) ((int16) ((char*) (A))[0]) << 8)))
32
#define mi_sint3korr(A) ((int32) (((((uchar*) (A))[0]) & 128) ? \
33
(((uint32) 255L << 24) | \
34
(((uint32) ((uchar*) (A))[0]) << 16) |\
35
(((uint32) ((uchar*) (A))[1]) << 8) | \
36
((uint32) ((uchar*) (A))[2])) : \
37
(((uint32) ((uchar*) (A))[0]) << 16) |\
38
(((uint32) ((uchar*) (A))[1]) << 8) | \
39
((uint32) ((uchar*) (A))[2])))
40
#define mi_sint4korr(A) ((int32) (((int32) (((uchar*) (A))[3])) +\
41
((int32) (((uchar*) (A))[2]) << 8) +\
42
((int32) (((uchar*) (A))[1]) << 16) +\
43
((int32) ((int16) ((char*) (A))[0]) << 24)))
44
#define mi_sint8korr(A) ((longlong) mi_uint8korr(A))
45
#define mi_uint2korr(A) ((uint16) (((uint16) (((uchar*) (A))[1])) +\
46
((uint16) (((uchar*) (A))[0]) << 8)))
47
#define mi_uint3korr(A) ((uint32) (((uint32) (((uchar*) (A))[2])) +\
48
(((uint32) (((uchar*) (A))[1])) << 8) +\
49
(((uint32) (((uchar*) (A))[0])) << 16)))
50
#define mi_uint4korr(A) ((uint32) (((uint32) (((uchar*) (A))[3])) +\
51
(((uint32) (((uchar*) (A))[2])) << 8) +\
52
(((uint32) (((uchar*) (A))[1])) << 16) +\
53
(((uint32) (((uchar*) (A))[0])) << 24)))
54
#define mi_uint5korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[4])) +\
55
(((uint32) (((uchar*) (A))[3])) << 8) +\
56
(((uint32) (((uchar*) (A))[2])) << 16) +\
57
(((uint32) (((uchar*) (A))[1])) << 24)) +\
58
(((ulonglong) (((uchar*) (A))[0])) << 32))
59
#define mi_uint6korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[5])) +\
60
(((uint32) (((uchar*) (A))[4])) << 8) +\
61
(((uint32) (((uchar*) (A))[3])) << 16) +\
62
(((uint32) (((uchar*) (A))[2])) << 24)) +\
63
(((ulonglong) (((uint32) (((uchar*) (A))[1])) +\
64
(((uint32) (((uchar*) (A))[0]) << 8)))) <<\
65
32))
66
#define mi_uint7korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[6])) +\
67
(((uint32) (((uchar*) (A))[5])) << 8) +\
68
(((uint32) (((uchar*) (A))[4])) << 16) +\
69
(((uint32) (((uchar*) (A))[3])) << 24)) +\
70
(((ulonglong) (((uint32) (((uchar*) (A))[2])) +\
71
(((uint32) (((uchar*) (A))[1])) << 8) +\
72
(((uint32) (((uchar*) (A))[0])) << 16))) <<\
73
32))
74
#define mi_uint8korr(A) ((ulonglong)(((uint32) (((uchar*) (A))[7])) +\
75
(((uint32) (((uchar*) (A))[6])) << 8) +\
76
(((uint32) (((uchar*) (A))[5])) << 16) +\
77
(((uint32) (((uchar*) (A))[4])) << 24)) +\
78
(((ulonglong) (((uint32) (((uchar*) (A))[3])) +\
79
(((uint32) (((uchar*) (A))[2])) << 8) +\
80
(((uint32) (((uchar*) (A))[1])) << 16) +\
81
(((uint32) (((uchar*) (A))[0])) << 24))) <<\
82
32))
83
84
/* This one is for uniformity */
85
#define mi_int1store(T,A) *((uchar*)(T))= (uchar) (A)
86
87
#define mi_int2store(T,A) { uint def_temp= (uint) (A) ;\
88
((uchar*) (T))[1]= (uchar) (def_temp);\
89
((uchar*) (T))[0]= (uchar) (def_temp >> 8); }
90
#define mi_int3store(T,A) {
/*lint -save -e734 */
\
91
ulong def_temp= (ulong) (A);\
92
((uchar*) (T))[2]= (uchar) (def_temp);\
93
((uchar*) (T))[1]= (uchar) (def_temp >> 8);\
94
((uchar*) (T))[0]= (uchar) (def_temp >> 16);\
95
/*lint -restore */
}
96
#define mi_int4store(T,A) { ulong def_temp= (ulong) (A);\
97
((uchar*) (T))[3]= (uchar) (def_temp);\
98
((uchar*) (T))[2]= (uchar) (def_temp >> 8);\
99
((uchar*) (T))[1]= (uchar) (def_temp >> 16);\
100
((uchar*) (T))[0]= (uchar) (def_temp >> 24); }
101
#define mi_int5store(T,A) { ulong def_temp= (ulong) (A),\
102
def_temp2= (ulong) ((A) >> 32);\
103
((uchar*) (T))[4]= (uchar) (def_temp);\
104
((uchar*) (T))[3]= (uchar) (def_temp >> 8);\
105
((uchar*) (T))[2]= (uchar) (def_temp >> 16);\
106
((uchar*) (T))[1]= (uchar) (def_temp >> 24);\
107
((uchar*) (T))[0]= (uchar) (def_temp2); }
108
#define mi_int6store(T,A) { ulong def_temp= (ulong) (A),\
109
def_temp2= (ulong) ((A) >> 32);\
110
((uchar*) (T))[5]= (uchar) (def_temp);\
111
((uchar*) (T))[4]= (uchar) (def_temp >> 8);\
112
((uchar*) (T))[3]= (uchar) (def_temp >> 16);\
113
((uchar*) (T))[2]= (uchar) (def_temp >> 24);\
114
((uchar*) (T))[1]= (uchar) (def_temp2);\
115
((uchar*) (T))[0]= (uchar) (def_temp2 >> 8); }
116
#define mi_int7store(T,A) { ulong def_temp= (ulong) (A),\
117
def_temp2= (ulong) ((A) >> 32);\
118
((uchar*) (T))[6]= (uchar) (def_temp);\
119
((uchar*) (T))[5]= (uchar) (def_temp >> 8);\
120
((uchar*) (T))[4]= (uchar) (def_temp >> 16);\
121
((uchar*) (T))[3]= (uchar) (def_temp >> 24);\
122
((uchar*) (T))[2]= (uchar) (def_temp2);\
123
((uchar*) (T))[1]= (uchar) (def_temp2 >> 8);\
124
((uchar*) (T))[0]= (uchar) (def_temp2 >> 16); }
125
#define mi_int8store(T,A) { ulong def_temp3= (ulong) (A),\
126
def_temp4= (ulong) ((A) >> 32);\
127
mi_int4store((uchar*) (T) + 0, def_temp4);\
128
mi_int4store((uchar*) (T) + 4, def_temp3); }
129
130
#ifdef WORDS_BIGENDIAN
131
132
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[0];\
133
((uchar*) (T))[1]= ((uchar*) &A)[1];\
134
((uchar*) (T))[2]= ((uchar*) &A)[2];\
135
((uchar*) (T))[3]= ((uchar*) &A)[3]; }
136
137
#define mi_float4get(V,M) { float def_temp;\
138
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
139
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
140
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
141
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
142
(V)= def_temp; }
143
144
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[0];\
145
((uchar*) (T))[1]= ((uchar*) &V)[1];\
146
((uchar*) (T))[2]= ((uchar*) &V)[2];\
147
((uchar*) (T))[3]= ((uchar*) &V)[3];\
148
((uchar*) (T))[4]= ((uchar*) &V)[4];\
149
((uchar*) (T))[5]= ((uchar*) &V)[5];\
150
((uchar*) (T))[6]= ((uchar*) &V)[6];\
151
((uchar*) (T))[7]= ((uchar*) &V)[7]; }
152
153
#define mi_float8get(V,M) { double def_temp;\
154
((uchar*) &def_temp)[0]= ((uchar*) (M))[0];\
155
((uchar*) &def_temp)[1]= ((uchar*) (M))[1];\
156
((uchar*) &def_temp)[2]= ((uchar*) (M))[2];\
157
((uchar*) &def_temp)[3]= ((uchar*) (M))[3];\
158
((uchar*) &def_temp)[4]= ((uchar*) (M))[4];\
159
((uchar*) &def_temp)[5]= ((uchar*) (M))[5];\
160
((uchar*) &def_temp)[6]= ((uchar*) (M))[6];\
161
((uchar*) &def_temp)[7]= ((uchar*) (M))[7]; \
162
(V)= def_temp; }
163
#else
164
165
#define mi_float4store(T,A) { ((uchar*) (T))[0]= ((uchar*) &A)[3];\
166
((uchar*) (T))[1]= ((uchar*) &A)[2];\
167
((uchar*) (T))[2]= ((uchar*) &A)[1];\
168
((uchar*) (T))[3]= ((uchar*) &A)[0]; }
169
170
#define mi_float4get(V,M) { float def_temp;\
171
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
172
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
173
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
174
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
175
(V)= def_temp; }
176
177
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
178
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[3];\
179
((uchar*) (T))[1]= ((uchar*) &V)[2];\
180
((uchar*) (T))[2]= ((uchar*) &V)[1];\
181
((uchar*) (T))[3]= ((uchar*) &V)[0];\
182
((uchar*) (T))[4]= ((uchar*) &V)[7];\
183
((uchar*) (T))[5]= ((uchar*) &V)[6];\
184
((uchar*) (T))[6]= ((uchar*) &V)[5];\
185
((uchar*) (T))[7]= ((uchar*) &V)[4];}
186
187
#define mi_float8get(V,M) { double def_temp;\
188
((uchar*) &def_temp)[0]= ((uchar*) (M))[3];\
189
((uchar*) &def_temp)[1]= ((uchar*) (M))[2];\
190
((uchar*) &def_temp)[2]= ((uchar*) (M))[1];\
191
((uchar*) &def_temp)[3]= ((uchar*) (M))[0];\
192
((uchar*) &def_temp)[4]= ((uchar*) (M))[7];\
193
((uchar*) &def_temp)[5]= ((uchar*) (M))[6];\
194
((uchar*) &def_temp)[6]= ((uchar*) (M))[5];\
195
((uchar*) &def_temp)[7]= ((uchar*) (M))[4];\
196
(V)= def_temp; }
197
198
#else
199
#define mi_float8store(T,V) { ((uchar*) (T))[0]= ((uchar*) &V)[7];\
200
((uchar*) (T))[1]= ((uchar*) &V)[6];\
201
((uchar*) (T))[2]= ((uchar*) &V)[5];\
202
((uchar*) (T))[3]= ((uchar*) &V)[4];\
203
((uchar*) (T))[4]= ((uchar*) &V)[3];\
204
((uchar*) (T))[5]= ((uchar*) &V)[2];\
205
((uchar*) (T))[6]= ((uchar*) &V)[1];\
206
((uchar*) (T))[7]= ((uchar*) &V)[0];}
207
208
#define mi_float8get(V,M) { double def_temp;\
209
((uchar*) &def_temp)[0]= ((uchar*) (M))[7];\
210
((uchar*) &def_temp)[1]= ((uchar*) (M))[6];\
211
((uchar*) &def_temp)[2]= ((uchar*) (M))[5];\
212
((uchar*) &def_temp)[3]= ((uchar*) (M))[4];\
213
((uchar*) &def_temp)[4]= ((uchar*) (M))[3];\
214
((uchar*) &def_temp)[5]= ((uchar*) (M))[2];\
215
((uchar*) &def_temp)[6]= ((uchar*) (M))[1];\
216
((uchar*) &def_temp)[7]= ((uchar*) (M))[0];\
217
(V)= def_temp; }
218
#endif
/* __FLOAT_WORD_ORDER */
219
#endif
/* WORDS_BIGENDIAN */
220
221
/* Fix to avoid warnings when sizeof(ha_rows) == sizeof(long) */
222
223
#ifdef BIG_TABLES
224
#define mi_rowstore(T,A) mi_int8store(T, A)
225
#define mi_rowkorr(T) mi_uint8korr(T)
226
#else
227
#define mi_rowstore(T,A) { mi_int4store(T, 0);\
228
mi_int4store(((uchar*) (T) + 4), A); }
229
#define mi_rowkorr(T) mi_uint4korr((uchar*) (T) + 4)
230
#endif
231
232
#if SIZEOF_OFF_T > 4
233
#define mi_sizestore(T,A) mi_int8store(T, A)
234
#define mi_sizekorr(T) mi_uint8korr(T)
235
#else
236
#define mi_sizestore(T,A) { if ((A) == HA_OFFSET_ERROR)\
237
memset((T), 255, 8);\
238
else { mi_int4store((T), 0);\
239
mi_int4store(((T) + 4), A); }}
240
#define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4)
241
#endif
242
#endif
/* MYISAMPACK_INCLUDED */
include
myisampack.h
Generated on Sat Nov 9 2013 01:24:45 for MySQL 5.6.14 Source Code Document by
1.8.1.2