~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-08-12 06:25:19 UTC
  • mto: (1114.1.1 innodb-plugin-merge)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090812062519-cij02mrrunvnxblt
Tags: innodb-plugin-1.0.4
InnoDB Plugin 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**********************************************************************
 
19
/******************************************************************//**
 
20
@file include/mach0data.ic
20
21
Utilities for converting data from the database file
21
22
to the machine format.
22
23
 
25
26
 
26
27
#include "ut0mem.h"
27
28
 
28
 
/***********************************************************
 
29
/*******************************************************//**
29
30
The following function is used to store data in one byte. */
30
31
UNIV_INLINE
31
32
void
32
33
mach_write_to_1(
33
34
/*============*/
34
 
        byte*   b,      /* in: pointer to byte where to store */
35
 
        ulint   n)      /* in: ulint integer to be stored, >= 0, < 256 */
 
35
        byte*   b,      /*!< in: pointer to byte where to store */
 
36
        ulint   n)      /*!< in: ulint integer to be stored, >= 0, < 256 */
36
37
{
37
38
        ut_ad(b);
38
39
        ut_ad(n <= 0xFFUL);
40
41
        b[0] = (byte)n;
41
42
}
42
43
 
43
 
/************************************************************
44
 
The following function is used to fetch data from one byte. */
 
44
/********************************************************//**
 
45
The following function is used to fetch data from one byte.
 
46
@return ulint integer, >= 0, < 256 */
45
47
UNIV_INLINE
46
48
ulint
47
49
mach_read_from_1(
48
50
/*=============*/
49
 
                                /* out: ulint integer, >= 0, < 256 */
50
 
        const byte*     b)      /* in: pointer to byte */
 
51
        const byte*     b)      /*!< in: pointer to byte */
51
52
{
52
53
        ut_ad(b);
53
54
        return((ulint)(b[0]));
54
55
}
55
56
 
56
 
/***********************************************************
 
57
/*******************************************************//**
57
58
The following function is used to store data in two consecutive
58
59
bytes. We store the most significant byte to the lowest address. */
59
60
UNIV_INLINE
60
61
void
61
62
mach_write_to_2(
62
63
/*============*/
63
 
        byte*   b,      /* in: pointer to two bytes where to store */
64
 
        ulint   n)      /* in: ulint integer to be stored */
 
64
        byte*   b,      /*!< in: pointer to two bytes where to store */
 
65
        ulint   n)      /*!< in: ulint integer to be stored */
65
66
{
66
67
        ut_ad(b);
67
68
        ut_ad(n <= 0xFFFFUL);
70
71
        b[1] = (byte)(n);
71
72
}
72
73
 
73
 
/************************************************************
 
74
/********************************************************//**
74
75
The following function is used to fetch data from 2 consecutive
75
 
bytes. The most significant byte is at the lowest address. */
 
76
bytes. The most significant byte is at the lowest address.
 
77
@return ulint integer */
76
78
UNIV_INLINE
77
79
ulint
78
80
mach_read_from_2(
79
81
/*=============*/
80
 
                                /* out: ulint integer */
81
 
        const byte*     b)      /* in: pointer to 2 bytes */
 
82
        const byte*     b)      /*!< in: pointer to 2 bytes */
82
83
{
83
84
        ut_ad(b);
84
85
        return( ((ulint)(b[0]) << 8)
86
87
                );
87
88
}
88
89
 
89
 
/************************************************************
 
90
/********************************************************//**
90
91
The following function is used to convert a 16-bit data item
91
92
to the canonical format, for fast bytewise equality test
92
 
against memory. */
 
93
against memory.
 
94
@return 16-bit integer in canonical format */
93
95
UNIV_INLINE
94
96
uint16
95
97
mach_encode_2(
96
98
/*==========*/
97
 
                        /* out: 16-bit integer in canonical format */
98
 
        ulint   n)      /* in: integer in machine-dependent format */
 
99
        ulint   n)      /*!< in: integer in machine-dependent format */
99
100
{
100
101
        uint16  ret;
101
102
        ut_ad(2 == sizeof ret);
102
103
        mach_write_to_2((byte*) &ret, n);
103
104
        return(ret);
104
105
}
105
 
/************************************************************
 
106
/********************************************************//**
106
107
The following function is used to convert a 16-bit data item
107
108
from the canonical format, for fast bytewise equality test
108
 
against memory. */
 
109
against memory.
 
110
@return integer in machine-dependent format */
109
111
UNIV_INLINE
110
112
ulint
111
113
mach_decode_2(
112
114
/*==========*/
113
 
                        /* out: integer in machine-dependent format */
114
 
        uint16  n)      /* in: 16-bit integer in canonical format */
 
115
        uint16  n)      /*!< in: 16-bit integer in canonical format */
115
116
{
116
117
        ut_ad(2 == sizeof n);
117
118
        return(mach_read_from_2((const byte*) &n));
118
119
}
119
120
 
120
 
/***********************************************************
 
121
/*******************************************************//**
121
122
The following function is used to store data in 3 consecutive
122
123
bytes. We store the most significant byte to the lowest address. */
123
124
UNIV_INLINE
124
125
void
125
126
mach_write_to_3(
126
127
/*============*/
127
 
        byte*   b,      /* in: pointer to 3 bytes where to store */
128
 
        ulint   n)      /* in: ulint integer to be stored */
 
128
        byte*   b,      /*!< in: pointer to 3 bytes where to store */
 
129
        ulint   n)      /*!< in: ulint integer to be stored */
129
130
{
130
131
        ut_ad(b);
131
132
        ut_ad(n <= 0xFFFFFFUL);
135
136
        b[2] = (byte)(n);
136
137
}
137
138
 
138
 
/************************************************************
 
139
/********************************************************//**
139
140
The following function is used to fetch data from 3 consecutive
140
 
bytes. The most significant byte is at the lowest address. */
 
141
bytes. The most significant byte is at the lowest address.
 
142
@return ulint integer */
141
143
UNIV_INLINE
142
144
ulint
143
145
mach_read_from_3(
144
146
/*=============*/
145
 
                                /* out: ulint integer */
146
 
        const byte*     b)      /* in: pointer to 3 bytes */
 
147
        const byte*     b)      /*!< in: pointer to 3 bytes */
147
148
{
148
149
        ut_ad(b);
149
150
        return( ((ulint)(b[0]) << 16)
152
153
                );
153
154
}
154
155
 
155
 
/***********************************************************
 
156
/*******************************************************//**
156
157
The following function is used to store data in four consecutive
157
158
bytes. We store the most significant byte to the lowest address. */
158
159
UNIV_INLINE
159
160
void
160
161
mach_write_to_4(
161
162
/*============*/
162
 
        byte*   b,      /* in: pointer to four bytes where to store */
163
 
        ulint   n)      /* in: ulint integer to be stored */
 
163
        byte*   b,      /*!< in: pointer to four bytes where to store */
 
164
        ulint   n)      /*!< in: ulint integer to be stored */
164
165
{
165
166
        ut_ad(b);
166
167
 
170
171
        b[3] = (byte)n;
171
172
}
172
173
 
173
 
/************************************************************
 
174
/********************************************************//**
174
175
The following function is used to fetch data from 4 consecutive
175
 
bytes. The most significant byte is at the lowest address. */
 
176
bytes. The most significant byte is at the lowest address.
 
177
@return ulint integer */
176
178
UNIV_INLINE
177
179
ulint
178
180
mach_read_from_4(
179
181
/*=============*/
180
 
                                /* out: ulint integer */
181
 
        const byte*     b)      /* in: pointer to four bytes */
 
182
        const byte*     b)      /*!< in: pointer to four bytes */
182
183
{
183
184
        ut_ad(b);
184
185
        return( ((ulint)(b[0]) << 24)
188
189
                );
189
190
}
190
191
 
191
 
/*************************************************************
 
192
/*********************************************************//**
192
193
Writes a ulint in a compressed form where the first byte codes the
193
194
length of the stored ulint. We look at the most significant bits of
194
195
the byte. If the most significant bit is zero, it means 1-byte storage,
195
196
else if the 2nd bit is 0, it means 2-byte storage, else if 3rd is 0,
196
197
it means 3-byte storage, else if 4th is 0, it means 4-byte storage,
197
 
else the storage is 5-byte. */
 
198
else the storage is 5-byte.
 
199
@return compressed size in bytes */
198
200
UNIV_INLINE
199
201
ulint
200
202
mach_write_compressed(
201
203
/*==================*/
202
 
                        /* out: compressed size in bytes */
203
 
        byte*   b,      /* in: pointer to memory where to store */
204
 
        ulint   n)      /* in: ulint integer (< 2^32) to be stored */
 
204
        byte*   b,      /*!< in: pointer to memory where to store */
 
205
        ulint   n)      /*!< in: ulint integer (< 2^32) to be stored */
205
206
{
206
207
        ut_ad(b);
207
208
 
224
225
        }
225
226
}
226
227
 
227
 
/*************************************************************
228
 
Returns the size of a ulint when written in the compressed form. */
 
228
/*********************************************************//**
 
229
Returns the size of a ulint when written in the compressed form.
 
230
@return compressed size in bytes */
229
231
UNIV_INLINE
230
232
ulint
231
233
mach_get_compressed_size(
232
234
/*=====================*/
233
 
                        /* out: compressed size in bytes */
234
 
        ulint   n)      /* in: ulint integer (< 2^32) to be stored */
 
235
        ulint   n)      /*!< in: ulint integer (< 2^32) to be stored */
235
236
{
236
237
        if (n < 0x80UL) {
237
238
                return(1);
246
247
        }
247
248
}
248
249
 
249
 
/*************************************************************
250
 
Reads a ulint in a compressed form. */
 
250
/*********************************************************//**
 
251
Reads a ulint in a compressed form.
 
252
@return read integer (< 2^32) */
251
253
UNIV_INLINE
252
254
ulint
253
255
mach_read_compressed(
254
256
/*=================*/
255
 
                                /* out: read integer (< 2^32) */
256
 
        const byte*     b)      /* in: pointer to memory from where to read */
 
257
        const byte*     b)      /*!< in: pointer to memory from where to read */
257
258
{
258
259
        ulint   flag;
259
260
 
275
276
        }
276
277
}
277
278
 
278
 
/***********************************************************
 
279
/*******************************************************//**
279
280
The following function is used to store data in 8 consecutive
280
281
bytes. We store the most significant byte to the lowest address. */
281
282
UNIV_INLINE
282
283
void
283
284
mach_write_to_8(
284
285
/*============*/
285
 
        byte*   b,      /* in: pointer to 8 bytes where to store */
286
 
        dulint  n)      /* in: dulint integer to be stored */
 
286
        byte*   b,      /*!< in: pointer to 8 bytes where to store */
 
287
        dulint  n)      /*!< in: dulint integer to be stored */
287
288
{
288
289
        ut_ad(b);
289
290
 
291
292
        mach_write_to_4(b + 4, ut_dulint_get_low(n));
292
293
}
293
294
 
294
 
/***********************************************************
 
295
/*******************************************************//**
295
296
The following function is used to store data in 8 consecutive
296
297
bytes. We store the most significant byte to the lowest address. */
297
298
UNIV_INLINE
298
299
void
299
300
mach_write_ull(
300
301
/*===========*/
301
 
        byte*           b,      /* in: pointer to 8 bytes where to store */
302
 
        ib_uint64_t     n)      /* in: 64-bit integer to be stored */
 
302
        byte*           b,      /*!< in: pointer to 8 bytes where to store */
 
303
        ib_uint64_t     n)      /*!< in: 64-bit integer to be stored */
303
304
{
304
305
        ut_ad(b);
305
306
 
307
308
        mach_write_to_4(b + 4, (ulint) n);
308
309
}
309
310
 
310
 
/************************************************************
 
311
/********************************************************//**
311
312
The following function is used to fetch data from 8 consecutive
312
 
bytes. The most significant byte is at the lowest address. */
 
313
bytes. The most significant byte is at the lowest address.
 
314
@return dulint integer */
313
315
UNIV_INLINE
314
316
dulint
315
317
mach_read_from_8(
316
318
/*=============*/
317
 
                                /* out: dulint integer */
318
 
        const byte*     b)      /* in: pointer to 8 bytes */
 
319
        const byte*     b)      /*!< in: pointer to 8 bytes */
319
320
{
320
321
        ulint   high;
321
322
        ulint   low;
328
329
        return(ut_dulint_create(high, low));
329
330
}
330
331
 
331
 
/************************************************************
 
332
/********************************************************//**
332
333
The following function is used to fetch data from 8 consecutive
333
 
bytes. The most significant byte is at the lowest address. */
 
334
bytes. The most significant byte is at the lowest address.
 
335
@return 64-bit integer */
334
336
UNIV_INLINE
335
337
ib_uint64_t
336
338
mach_read_ull(
337
339
/*==========*/
338
 
                                /* out: 64-bit integer */
339
 
        const byte*     b)      /* in: pointer to 8 bytes */
 
340
        const byte*     b)      /*!< in: pointer to 8 bytes */
340
341
{
341
342
        ib_uint64_t     ull;
342
343
 
346
347
        return(ull);
347
348
}
348
349
 
349
 
/***********************************************************
 
350
/*******************************************************//**
350
351
The following function is used to store data in 7 consecutive
351
352
bytes. We store the most significant byte to the lowest address. */
352
353
UNIV_INLINE
353
354
void
354
355
mach_write_to_7(
355
356
/*============*/
356
 
        byte*   b,      /* in: pointer to 7 bytes where to store */
357
 
        dulint  n)      /* in: dulint integer to be stored */
 
357
        byte*   b,      /*!< in: pointer to 7 bytes where to store */
 
358
        dulint  n)      /*!< in: dulint integer to be stored */
358
359
{
359
360
        ut_ad(b);
360
361
 
362
363
        mach_write_to_4(b + 3, ut_dulint_get_low(n));
363
364
}
364
365
 
365
 
/************************************************************
 
366
/********************************************************//**
366
367
The following function is used to fetch data from 7 consecutive
367
 
bytes. The most significant byte is at the lowest address. */
 
368
bytes. The most significant byte is at the lowest address.
 
369
@return dulint integer */
368
370
UNIV_INLINE
369
371
dulint
370
372
mach_read_from_7(
371
373
/*=============*/
372
 
                                /* out: dulint integer */
373
 
        const byte*     b)      /* in: pointer to 7 bytes */
 
374
        const byte*     b)      /*!< in: pointer to 7 bytes */
374
375
{
375
376
        ulint   high;
376
377
        ulint   low;
383
384
        return(ut_dulint_create(high, low));
384
385
}
385
386
 
386
 
/***********************************************************
 
387
/*******************************************************//**
387
388
The following function is used to store data in 6 consecutive
388
389
bytes. We store the most significant byte to the lowest address. */
389
390
UNIV_INLINE
390
391
void
391
392
mach_write_to_6(
392
393
/*============*/
393
 
        byte*   b,      /* in: pointer to 6 bytes where to store */
394
 
        dulint  n)      /* in: dulint integer to be stored */
 
394
        byte*   b,      /*!< in: pointer to 6 bytes where to store */
 
395
        dulint  n)      /*!< in: dulint integer to be stored */
395
396
{
396
397
        ut_ad(b);
397
398
 
399
400
        mach_write_to_4(b + 2, ut_dulint_get_low(n));
400
401
}
401
402
 
402
 
/************************************************************
 
403
/********************************************************//**
403
404
The following function is used to fetch data from 6 consecutive
404
 
bytes. The most significant byte is at the lowest address. */
 
405
bytes. The most significant byte is at the lowest address.
 
406
@return dulint integer */
405
407
UNIV_INLINE
406
408
dulint
407
409
mach_read_from_6(
408
410
/*=============*/
409
 
                                /* out: dulint integer */
410
 
        const byte*     b)      /* in: pointer to 6 bytes */
 
411
        const byte*     b)      /*!< in: pointer to 6 bytes */
411
412
{
412
413
        ulint   high;
413
414
        ulint   low;
420
421
        return(ut_dulint_create(high, low));
421
422
}
422
423
 
423
 
/*************************************************************
424
 
Writes a dulint in a compressed form (5..9 bytes). */
 
424
/*********************************************************//**
 
425
Writes a dulint in a compressed form (5..9 bytes).
 
426
@return size in bytes */
425
427
UNIV_INLINE
426
428
ulint
427
429
mach_dulint_write_compressed(
428
430
/*=========================*/
429
 
                        /* out: size in bytes */
430
 
        byte*   b,      /* in: pointer to memory where to store */
431
 
        dulint  n)      /* in: dulint integer to be stored */
 
431
        byte*   b,      /*!< in: pointer to memory where to store */
 
432
        dulint  n)      /*!< in: dulint integer to be stored */
432
433
{
433
434
        ulint   size;
434
435
 
440
441
        return(size + 4);
441
442
}
442
443
 
443
 
/*************************************************************
444
 
Returns the size of a dulint when written in the compressed form. */
 
444
/*********************************************************//**
 
445
Returns the size of a dulint when written in the compressed form.
 
446
@return compressed size in bytes */
445
447
UNIV_INLINE
446
448
ulint
447
449
mach_dulint_get_compressed_size(
448
450
/*============================*/
449
 
                        /* out: compressed size in bytes */
450
 
        dulint   n)     /* in: dulint integer to be stored */
 
451
        dulint   n)     /*!< in: dulint integer to be stored */
451
452
{
452
453
        return(4 + mach_get_compressed_size(ut_dulint_get_high(n)));
453
454
}
454
455
 
455
 
/*************************************************************
456
 
Reads a dulint in a compressed form. */
 
456
/*********************************************************//**
 
457
Reads a dulint in a compressed form.
 
458
@return read dulint */
457
459
UNIV_INLINE
458
460
dulint
459
461
mach_dulint_read_compressed(
460
462
/*========================*/
461
 
                                /* out: read dulint */
462
 
        const byte*     b)      /* in: pointer to memory from where to read */
 
463
        const byte*     b)      /*!< in: pointer to memory from where to read */
463
464
{
464
465
        ulint   high;
465
466
        ulint   low;
476
477
        return(ut_dulint_create(high, low));
477
478
}
478
479
 
479
 
/*************************************************************
480
 
Writes a dulint in a compressed form (1..11 bytes). */
 
480
/*********************************************************//**
 
481
Writes a dulint in a compressed form (1..11 bytes).
 
482
@return size in bytes */
481
483
UNIV_INLINE
482
484
ulint
483
485
mach_dulint_write_much_compressed(
484
486
/*==============================*/
485
 
                        /* out: size in bytes */
486
 
        byte*   b,      /* in: pointer to memory where to store */
487
 
        dulint  n)      /* in: dulint integer to be stored */
 
487
        byte*   b,      /*!< in: pointer to memory where to store */
 
488
        dulint  n)      /*!< in: dulint integer to be stored */
488
489
{
489
490
        ulint   size;
490
491
 
502
503
        return(size);
503
504
}
504
505
 
505
 
/*************************************************************
506
 
Returns the size of a dulint when written in the compressed form. */
 
506
/*********************************************************//**
 
507
Returns the size of a dulint when written in the compressed form.
 
508
@return compressed size in bytes */
507
509
UNIV_INLINE
508
510
ulint
509
511
mach_dulint_get_much_compressed_size(
510
512
/*=================================*/
511
 
                        /* out: compressed size in bytes */
512
 
        dulint   n)     /* in: dulint integer to be stored */
 
513
        dulint   n)     /*!< in: dulint integer to be stored */
513
514
{
514
515
        if (0 == ut_dulint_get_high(n)) {
515
516
                return(mach_get_compressed_size(ut_dulint_get_low(n)));
519
520
               + mach_get_compressed_size(ut_dulint_get_low(n)));
520
521
}
521
522
 
522
 
/*************************************************************
523
 
Reads a dulint in a compressed form. */
 
523
/*********************************************************//**
 
524
Reads a dulint in a compressed form.
 
525
@return read dulint */
524
526
UNIV_INLINE
525
527
dulint
526
528
mach_dulint_read_much_compressed(
527
529
/*=============================*/
528
 
                                /* out: read dulint */
529
 
        const byte*     b)      /* in: pointer to memory from where to read */
 
530
        const byte*     b)      /*!< in: pointer to memory from where to read */
530
531
{
531
532
        ulint   high;
532
533
        ulint   low;
547
548
 
548
549
        return(ut_dulint_create(high, low));
549
550
}
550
 
 
551
 
/*************************************************************
552
 
Reads a double. It is stored in a little-endian format. */
 
551
#ifndef UNIV_HOTBACKUP
 
552
/*********************************************************//**
 
553
Reads a double. It is stored in a little-endian format.
 
554
@return double read */
553
555
UNIV_INLINE
554
556
double
555
557
mach_double_read(
556
558
/*=============*/
557
 
                                /* out: double read */
558
 
        const byte*     b)      /* in: pointer to memory from where to read */
 
559
        const byte*     b)      /*!< in: pointer to memory from where to read */
559
560
{
560
561
        double  d;
561
562
        ulint   i;
574
575
        return(d);
575
576
}
576
577
 
577
 
/*************************************************************
 
578
/*********************************************************//**
578
579
Writes a double. It is stored in a little-endian format. */
579
580
UNIV_INLINE
580
581
void
581
582
mach_double_write(
582
583
/*==============*/
583
 
        byte*   b,      /* in: pointer to memory where to write */
584
 
        double  d)      /* in: double */
 
584
        byte*   b,      /*!< in: pointer to memory where to write */
 
585
        double  d)      /*!< in: double */
585
586
{
586
587
        ulint   i;
587
588
        byte*   ptr;
597
598
        }
598
599
}
599
600
 
600
 
/*************************************************************
601
 
Reads a float. It is stored in a little-endian format. */
 
601
/*********************************************************//**
 
602
Reads a float. It is stored in a little-endian format.
 
603
@return float read */
602
604
UNIV_INLINE
603
605
float
604
606
mach_float_read(
605
607
/*============*/
606
 
                                /* out: float read */
607
 
        const byte*     b)      /* in: pointer to memory from where to read */
 
608
        const byte*     b)      /*!< in: pointer to memory from where to read */
608
609
{
609
610
        float   d;
610
611
        ulint   i;
623
624
        return(d);
624
625
}
625
626
 
626
 
/*************************************************************
 
627
/*********************************************************//**
627
628
Writes a float. It is stored in a little-endian format. */
628
629
UNIV_INLINE
629
630
void
630
631
mach_float_write(
631
632
/*=============*/
632
 
        byte*   b,      /* in: pointer to memory where to write */
633
 
        float   d)      /* in: float */
 
633
        byte*   b,      /*!< in: pointer to memory where to write */
 
634
        float   d)      /*!< in: float */
634
635
{
635
636
        ulint   i;
636
637
        byte*   ptr;
646
647
        }
647
648
}
648
649
 
649
 
/*************************************************************
650
 
Reads a ulint stored in the little-endian format. */
 
650
/*********************************************************//**
 
651
Reads a ulint stored in the little-endian format.
 
652
@return unsigned long int */
651
653
UNIV_INLINE
652
654
ulint
653
655
mach_read_from_n_little_endian(
654
656
/*===========================*/
655
 
                                        /* out: unsigned long int */
656
 
        const byte*     buf,            /* in: from where to read */
657
 
        ulint           buf_size)       /* in: from how many bytes to read */
 
657
        const byte*     buf,            /*!< in: from where to read */
 
658
        ulint           buf_size)       /*!< in: from how many bytes to read */
658
659
{
659
660
        ulint   n       = 0;
660
661
        const byte*     ptr;
679
680
        return(n);
680
681
}
681
682
 
682
 
/*************************************************************
 
683
/*********************************************************//**
683
684
Writes a ulint in the little-endian format. */
684
685
UNIV_INLINE
685
686
void
686
687
mach_write_to_n_little_endian(
687
688
/*==========================*/
688
 
        byte*   dest,           /* in: where to write */
689
 
        ulint   dest_size,      /* in: into how many bytes to write */
690
 
        ulint   n)              /* in: unsigned long int to write */
 
689
        byte*   dest,           /*!< in: where to write */
 
690
        ulint   dest_size,      /*!< in: into how many bytes to write */
 
691
        ulint   n)              /*!< in: unsigned long int to write */
691
692
{
692
693
        byte*   end;
693
694
 
711
712
        ut_ad(n == 0);
712
713
}
713
714
 
714
 
/*************************************************************
715
 
Reads a ulint stored in the little-endian format. */
 
715
/*********************************************************//**
 
716
Reads a ulint stored in the little-endian format.
 
717
@return unsigned long int */
716
718
UNIV_INLINE
717
719
ulint
718
720
mach_read_from_2_little_endian(
719
721
/*===========================*/
720
 
                                        /* out: unsigned long int */
721
 
        const byte*     buf)            /* in: from where to read */
 
722
        const byte*     buf)            /*!< in: from where to read */
722
723
{
723
724
        return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
724
725
}
725
726
 
726
 
/*************************************************************
 
727
/*********************************************************//**
727
728
Writes a ulint in the little-endian format. */
728
729
UNIV_INLINE
729
730
void
730
731
mach_write_to_2_little_endian(
731
732
/*==========================*/
732
 
        byte*   dest,           /* in: where to write */
733
 
        ulint   n)              /* in: unsigned long int to write */
 
733
        byte*   dest,           /*!< in: where to write */
 
734
        ulint   n)              /*!< in: unsigned long int to write */
734
735
{
735
736
        ut_ad(n < 256 * 256);
736
737
 
742
743
        *dest = (byte)(n & 0xFFUL);
743
744
}
744
745
 
745
 
/*************************************************************
 
746
/*********************************************************//**
746
747
Convert integral type from storage byte order (big endian) to
747
 
host byte order. */
 
748
host byte order.
 
749
@return integer value */
748
750
UNIV_INLINE
749
751
ullint
750
752
mach_read_int_type(
751
753
/*===============*/
752
 
                                        /* out: integer value */
753
 
        const byte*     src,            /* in: where to read from */
754
 
        ulint           len,            /* in: length of src */
755
 
        ibool           unsigned_type)  /* in: signed or unsigned flag */
 
754
        const byte*     src,            /*!< in: where to read from */
 
755
        ulint           len,            /*!< in: length of src */
 
756
        ibool           unsigned_type)  /*!< in: signed or unsigned flag */
756
757
{
757
758
        /* XXX this can be optimized on big-endian machines */
758
759
 
782
783
 
783
784
        return(ret);
784
785
}
 
786
#endif /* !UNIV_HOTBACKUP */