~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/mach0data.h

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
ulint
33
33
mach_read_from_1(
34
34
/*=============*/
35
 
                        /* out: ulint integer, >= 0, < 256 */
36
 
        byte*   b);      /* in: pointer to byte */
 
35
                                /* out: ulint integer, >= 0, < 256 */
 
36
        const byte*     b)      /* in: pointer to byte */
 
37
        __attribute__((nonnull, pure));
37
38
/***********************************************************
38
39
The following function is used to store data in two consecutive
39
40
bytes. We store the most significant byte to the lower address. */
50
51
ulint
51
52
mach_read_from_2(
52
53
/*=============*/
53
 
                        /* out: ulint integer, >= 0, < 64k */
54
 
        byte*   b);      /* in: pointer to two bytes */
 
54
                                /* out: ulint integer, >= 0, < 64k */
 
55
        const byte*     b)      /* in: pointer to two bytes */
 
56
        __attribute__((nonnull, pure));
55
57
 
56
58
/************************************************************
57
59
The following function is used to convert a 16-bit data item
58
60
to the canonical format, for fast bytewise equality test
59
61
against memory. */
60
62
UNIV_INLINE
61
 
uint16_t
 
63
uint16
62
64
mach_encode_2(
63
65
/*==========*/
64
66
                        /* out: 16-bit integer in canonical format */
65
 
        ulint   n);     /* in: integer in machine-dependent format */
 
67
        ulint   n)      /* in: integer in machine-dependent format */
 
68
        __attribute__((__const__));
66
69
/************************************************************
67
70
The following function is used to convert a 16-bit data item
68
71
from the canonical format, for fast bytewise equality test
72
75
mach_decode_2(
73
76
/*==========*/
74
77
                        /* out: integer in machine-dependent format */
75
 
        uint16_t        n);     /* in: 16-bit integer in canonical format */
 
78
        uint16  n)      /* in: 16-bit integer in canonical format */
 
79
        __attribute__((__const__));
76
80
/***********************************************************
77
81
The following function is used to store data in 3 consecutive
78
82
bytes. We store the most significant byte to the lowest address. */
89
93
ulint
90
94
mach_read_from_3(
91
95
/*=============*/
92
 
                        /* out: ulint integer */
93
 
        byte*   b);      /* in: pointer to 3 bytes */
 
96
                                /* out: ulint integer */
 
97
        const byte*     b)      /* in: pointer to 3 bytes */
 
98
        __attribute__((nonnull, pure));
94
99
/***********************************************************
95
100
The following function is used to store data in four consecutive
96
101
bytes. We store the most significant byte to the lowest address. */
107
112
ulint
108
113
mach_read_from_4(
109
114
/*=============*/
110
 
                        /* out: ulint integer */
111
 
        byte*   b);      /* in: pointer to four bytes */
 
115
                                /* out: ulint integer */
 
116
        const byte*     b)      /* in: pointer to four bytes */
 
117
        __attribute__((nonnull, pure));
112
118
/*************************************************************
113
119
Writes a ulint in a compressed form (1..5 bytes). */
114
120
UNIV_INLINE
125
131
mach_get_compressed_size(
126
132
/*=====================*/
127
133
                        /* out: compressed size in bytes */
128
 
        ulint   n);     /* in: ulint integer to be stored */
 
134
        ulint   n)      /* in: ulint integer to be stored */
 
135
        __attribute__((__const__));
129
136
/*************************************************************
130
137
Reads a ulint in a compressed form. */
131
138
UNIV_INLINE
132
139
ulint
133
140
mach_read_compressed(
134
141
/*=================*/
135
 
                        /* out: read integer */
136
 
        byte*   b);     /* in: pointer to memory from where to read */
 
142
                                /* out: read integer */
 
143
        const byte*     b)      /* in: pointer to memory from where to read */
 
144
        __attribute__((nonnull, pure));
137
145
/***********************************************************
138
146
The following function is used to store data in 6 consecutive
139
147
bytes. We store the most significant byte to the lowest address. */
150
158
dulint
151
159
mach_read_from_6(
152
160
/*=============*/
153
 
                        /* out: dulint integer */
154
 
        byte*   b);      /* in: pointer to 6 bytes */
 
161
                                /* out: dulint integer */
 
162
        const byte*     b)      /* in: pointer to 6 bytes */
 
163
        __attribute__((nonnull, pure));
155
164
/***********************************************************
156
165
The following function is used to store data in 7 consecutive
157
166
bytes. We store the most significant byte to the lowest address. */
168
177
dulint
169
178
mach_read_from_7(
170
179
/*=============*/
171
 
                        /* out: dulint integer */
172
 
        byte*   b);      /* in: pointer to 7 bytes */
 
180
                                /* out: dulint integer */
 
181
        const byte*     b)      /* in: pointer to 7 bytes */
 
182
        __attribute__((nonnull, pure));
173
183
/***********************************************************
174
184
The following function is used to store data in 8 consecutive
175
185
bytes. We store the most significant byte to the lowest address. */
179
189
/*============*/
180
190
        byte*   b,      /* in: pointer to 8 bytes where to store */
181
191
        dulint  n);     /* in: dulint integer to be stored */
 
192
/***********************************************************
 
193
The following function is used to store data in 8 consecutive
 
194
bytes. We store the most significant byte to the lowest address. */
 
195
UNIV_INLINE
 
196
void
 
197
mach_write_ull(
 
198
/*===========*/
 
199
        byte*           b,      /* in: pointer to 8 bytes where to store */
 
200
        ib_uint64_t     n);     /* in: 64-bit integer to be stored */
182
201
/************************************************************
183
202
The following function is used to fetch data from 8 consecutive
184
203
bytes. The most significant byte is at the lowest address. */
186
205
dulint
187
206
mach_read_from_8(
188
207
/*=============*/
189
 
                        /* out: dulint integer */
190
 
        byte*   b);      /* in: pointer to 8 bytes */
 
208
                                /* out: dulint integer */
 
209
        const byte*     b)      /* in: pointer to 8 bytes */
 
210
        __attribute__((nonnull, pure));
 
211
/************************************************************
 
212
The following function is used to fetch data from 8 consecutive
 
213
bytes. The most significant byte is at the lowest address. */
 
214
UNIV_INLINE
 
215
ib_uint64_t
 
216
mach_read_ull(
 
217
/*==========*/
 
218
                                /* out: 64-bit integer */
 
219
        const byte*     b)      /* in: pointer to 8 bytes */
 
220
        __attribute__((nonnull, pure));
191
221
/*************************************************************
192
222
Writes a dulint in a compressed form (5..9 bytes). */
193
223
UNIV_INLINE
211
241
dulint
212
242
mach_dulint_read_compressed(
213
243
/*========================*/
214
 
                        /* out: read dulint */
215
 
        byte*   b);     /* in: pointer to memory from where to read */
 
244
                                /* out: read dulint */
 
245
        const byte*     b)      /* in: pointer to memory from where to read */
 
246
        __attribute__((nonnull, pure));
216
247
/*************************************************************
217
248
Writes a dulint in a compressed form (1..11 bytes). */
218
249
UNIV_INLINE
229
260
mach_dulint_get_much_compressed_size(
230
261
/*=================================*/
231
262
                        /* out: compressed size in bytes */
232
 
        dulint   n);     /* in: dulint integer to be stored */
 
263
        dulint   n)      /* in: dulint integer to be stored */
 
264
        __attribute__((__const__));
233
265
/*************************************************************
234
266
Reads a dulint in a compressed form. */
235
267
UNIV_INLINE
236
268
dulint
237
269
mach_dulint_read_much_compressed(
238
270
/*=============================*/
239
 
                        /* out: read dulint */
240
 
        byte*   b);      /* in: pointer to memory from where to read */
 
271
                                /* out: read dulint */
 
272
        const byte*     b)      /* in: pointer to memory from where to read */
 
273
        __attribute__((nonnull, pure));
241
274
/*************************************************************
242
275
Reads a ulint in a compressed form if the log record fully contains it. */
243
 
 
 
276
UNIV_INTERN
244
277
byte*
245
278
mach_parse_compressed(
246
279
/*==================*/
251
284
        ulint*  val);   /* out: read value */
252
285
/*************************************************************
253
286
Reads a dulint in a compressed form if the log record fully contains it. */
254
 
 
 
287
UNIV_INTERN
255
288
byte*
256
289
mach_dulint_parse_compressed(
257
290
/*=========================*/
266
299
double
267
300
mach_double_read(
268
301
/*=============*/
269
 
                        /* out: double read */
270
 
        byte*   b);      /* in: pointer to memory from where to read */
 
302
                                /* out: double read */
 
303
        const byte*     b)      /* in: pointer to memory from where to read */
 
304
        __attribute__((nonnull, pure));
271
305
/*************************************************************
272
306
Writes a double. It is stored in a little-endian format. */
273
307
UNIV_INLINE
282
316
float
283
317
mach_float_read(
284
318
/*============*/
285
 
                        /* out: float read */
286
 
        byte*   b);      /* in: pointer to memory from where to read */
 
319
                                /* out: float read */
 
320
        const byte*     b)      /* in: pointer to memory from where to read */
 
321
        __attribute__((nonnull, pure));
287
322
/*************************************************************
288
323
Writes a float. It is stored in a little-endian format. */
289
324
UNIV_INLINE
298
333
ulint
299
334
mach_read_from_n_little_endian(
300
335
/*===========================*/
301
 
                                /* out: unsigned long int */
302
 
        byte*   buf,            /* in: from where to read */
303
 
        ulint   buf_size);      /* in: from how many bytes to read */
 
336
                                        /* out: unsigned long int */
 
337
        const byte*     buf,            /* in: from where to read */
 
338
        ulint           buf_size)       /* in: from how many bytes to read */
 
339
        __attribute__((nonnull, pure));
304
340
/*************************************************************
305
341
Writes a ulint in the little-endian format. */
306
342
UNIV_INLINE
316
352
ulint
317
353
mach_read_from_2_little_endian(
318
354
/*===========================*/
319
 
                                /* out: unsigned long int */
320
 
        byte*   buf);           /* in: from where to read */
 
355
                                        /* out: unsigned long int */
 
356
        const byte*     buf)            /* in: from where to read */
 
357
        __attribute__((nonnull, pure));
321
358
/*************************************************************
322
359
Writes a ulint in the little-endian format. */
323
360
UNIV_INLINE
331
368
Convert integral type from storage byte order (big endian) to
332
369
host byte order. */
333
370
UNIV_INLINE
334
 
void
 
371
ullint
335
372
mach_read_int_type(
336
373
/*===============*/
337
 
        byte*           dest,           /* out: where to write */
 
374
                                        /* out: integer value */
338
375
        const byte*     src,            /* in: where to read from */
339
376
        ulint           len,            /* in: length of src */
340
377
        ibool           unsigned_type); /* in: signed or unsigned flag */