348
byte* b, /*!< in: pointer to 6 bytes where to store */
349
ib_uint64_t n) /*!< in: 48-bit integer */
391
byte* b, /*!< in: pointer to 6 bytes where to store */
392
dulint n) /*!< in: dulint integer to be stored */
353
mach_write_to_2(b, (ulint) (n >> 32));
354
mach_write_to_4(b + 2, (ulint) n);
396
mach_write_to_2(b, ut_dulint_get_high(n));
397
mach_write_to_4(b + 2, ut_dulint_get_low(n));
357
400
/********************************************************//**
358
401
The following function is used to fetch data from 6 consecutive
359
402
bytes. The most significant byte is at the lowest address.
360
@return 48-bit integer */
403
@return dulint integer */
363
406
mach_read_from_6(
364
407
/*=============*/
365
408
const byte* b) /*!< in: pointer to 6 bytes */
369
return(ut_ull_create(mach_read_from_2(b), mach_read_from_4(b + 2)));
415
high = mach_read_from_2(b);
416
low = mach_read_from_4(b + 2);
418
return(ut_dulint_create(high, low));
372
421
/*********************************************************//**
373
Writes a 64-bit integer in a compressed form (5..9 bytes).
422
Writes a dulint in a compressed form (5..9 bytes).
374
423
@return size in bytes */
377
mach_ull_write_compressed(
378
/*======================*/
379
byte* b, /*!< in: pointer to memory where to store */
380
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
426
mach_dulint_write_compressed(
427
/*=========================*/
428
byte* b, /*!< in: pointer to memory where to store */
429
dulint n) /*!< in: dulint integer to be stored */
386
size = mach_write_compressed(b, (ulint) (n >> 32));
387
mach_write_to_4(b + size, (ulint) n);
435
size = mach_write_compressed(b, ut_dulint_get_high(n));
436
mach_write_to_4(b + size, ut_dulint_get_low(n));
389
438
return(size + 4);
392
441
/*********************************************************//**
393
Returns the size of a 64-bit integer when written in the compressed form.
442
Returns the size of a dulint when written in the compressed form.
394
443
@return compressed size in bytes */
397
mach_ull_get_compressed_size(
398
/*=========================*/
399
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
446
mach_dulint_get_compressed_size(
447
/*============================*/
448
dulint n) /*!< in: dulint integer to be stored */
401
return(4 + mach_get_compressed_size((ulint) (n >> 32)));
450
return(4 + mach_get_compressed_size(ut_dulint_get_high(n)));
404
453
/*********************************************************//**
405
Reads a 64-bit integer in a compressed form.
406
@return the value read */
454
Reads a dulint in a compressed form.
455
@return read dulint */
409
mach_ull_read_compressed(
410
/*=====================*/
458
mach_dulint_read_compressed(
459
/*========================*/
411
460
const byte* b) /*!< in: pointer to memory from where to read */
418
n = (ib_uint64_t) mach_read_compressed(b);
420
size = mach_get_compressed_size((ulint) n);
423
n |= (ib_uint64_t) mach_read_from_4(b + size);
468
high = mach_read_compressed(b);
470
size = mach_get_compressed_size(high);
472
low = mach_read_from_4(b + size);
474
return(ut_dulint_create(high, low));
428
477
/*********************************************************//**
429
Writes a 64-bit integer in a compressed form (1..11 bytes).
478
Writes a dulint in a compressed form (1..11 bytes).
430
479
@return size in bytes */
433
mach_ull_write_much_compressed(
434
/*===========================*/
435
byte* b, /*!< in: pointer to memory where to store */
436
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
482
mach_dulint_write_much_compressed(
483
/*==============================*/
484
byte* b, /*!< in: pointer to memory where to store */
485
dulint n) /*!< in: dulint integer to be stored */
443
return(mach_write_compressed(b, (ulint) n));
491
if (ut_dulint_get_high(n) == 0) {
492
return(mach_write_compressed(b, ut_dulint_get_low(n)));
447
size = 1 + mach_write_compressed(b + 1, (ulint) (n >> 32));
496
size = 1 + mach_write_compressed(b + 1, ut_dulint_get_high(n));
449
size += mach_write_compressed(b + size, (ulint) n & 0xFFFFFFFF);
498
size += mach_write_compressed(b + size, ut_dulint_get_low(n));
454
503
/*********************************************************//**
455
Returns the size of a 64-bit integer when written in the compressed form.
504
Returns the size of a dulint when written in the compressed form.
456
505
@return compressed size in bytes */
459
mach_ull_get_much_compressed_size(
460
/*==============================*/
461
ib_uint64_t n) /*!< in: 64-bit integer to be stored */
508
mach_dulint_get_much_compressed_size(
509
/*=================================*/
510
dulint n) /*!< in: dulint integer to be stored */
464
return(mach_get_compressed_size((ulint) n));
512
if (0 == ut_dulint_get_high(n)) {
513
return(mach_get_compressed_size(ut_dulint_get_low(n)));
467
return(1 + mach_get_compressed_size((ulint) (n >> 32))
468
+ mach_get_compressed_size((ulint) n & ULINT32_MASK));
516
return(1 + mach_get_compressed_size(ut_dulint_get_high(n))
517
+ mach_get_compressed_size(ut_dulint_get_low(n)));
471
520
/*********************************************************//**
472
Reads a 64-bit integer in a compressed form.
473
@return the value read */
521
Reads a dulint in a compressed form.
522
@return read dulint */
476
mach_ull_read_much_compressed(
477
/*==========================*/
525
mach_dulint_read_much_compressed(
526
/*=============================*/
478
527
const byte* b) /*!< in: pointer to memory from where to read */
485
535
if (*b != (byte)0xFF) {
489
n = (ib_uint64_t) mach_read_compressed(b + 1);
491
size = 1 + mach_get_compressed_size((ulint) n);
495
n |= mach_read_compressed(b + size);
500
/*********************************************************//**
501
Reads a 64-bit integer in a compressed form
502
if the log record fully contains it.
503
@return pointer to end of the stored field, NULL if not complete */
506
mach_ull_parse_compressed(
507
/*======================*/
508
byte* ptr, /* in: pointer to buffer from where to read */
509
byte* end_ptr,/* in: pointer to end of the buffer */
510
ib_uint64_t* val) /* out: read value */
518
if (end_ptr < ptr + 5) {
523
*val = mach_read_compressed(ptr);
525
size = mach_get_compressed_size((ulint) *val);
529
if (end_ptr < ptr + 4) {
535
*val |= mach_read_from_4(ptr);
539
high = mach_read_compressed(b + 1);
541
size = 1 + mach_get_compressed_size(high);
544
low = mach_read_compressed(b + size);
546
return(ut_dulint_create(high, low));
539
548
#ifndef UNIV_HOTBACKUP
540
549
/*********************************************************//**