MySQL 9.0.0
Source Code Documentation
ut0byte.h File Reference

Utilities for byte operations. More...

#include "univ.i"
#include "ut0ut.h"
#include "ut0byte.ic"

Go to the source code of this file.

Functions

constexpr uint64_t ut_ull_create (uint32_t high, uint32_t low)
 Creates a 64-bit integer out of two 32-bit integers. More...
 
static uint64_t ut_uint64_align_down (uint64_t n, ulint align_no)
 Rounds a 64-bit integer downward to a multiple of a power of 2. More...
 
static uint64_t ut_uint64_align_up (uint64_t n, ulint align_no)
 Rounds uint64_t upward to a multiple of a power of 2. More...
 
static void * ut_align (const void *ptr, ulint align_no)
 The following function rounds up a pointer to the nearest aligned address. More...
 
static void * ut_align_down (const void *ptr, ulint align_no)
 The following function rounds down a pointer to the nearest aligned address. More...
 
static ulint ut_align_offset (const void *ptr, ulint align_no)
 The following function computes the offset of a pointer from the nearest aligned address. More...
 
static bool ut_bit_get_nth (ulint a, ulint n)
 Gets the nth bit of a ulint. More...
 
static ulint ut_bit_set_nth (ulint a, ulint n, bool val)
 Sets the nth bit of a ulint. More...
 

Detailed Description

Utilities for byte operations.

Created 1/20/1994 Heikki Tuuri

Function Documentation

◆ ut_align()

static void * ut_align ( const void *  ptr,
ulint  align_no 
)
inlinestatic

The following function rounds up a pointer to the nearest aligned address.

Parameters
[in]ptrpointer
[in]align_noalign by this number
Returns
aligned pointer

◆ ut_align_down()

static void * ut_align_down ( const void *  ptr,
ulint  align_no 
)
inlinestatic

The following function rounds down a pointer to the nearest aligned address.

Parameters
[in]ptrpointer
[in]align_noalign by this number
Returns
aligned pointer

◆ ut_align_offset()

static ulint ut_align_offset ( const void *  ptr,
ulint  align_no 
)
inlinestatic

The following function computes the offset of a pointer from the nearest aligned address.

Parameters
[in]ptrpointer
[in]align_noalign by this number
Returns
distance from aligned pointer

◆ ut_bit_get_nth()

static bool ut_bit_get_nth ( ulint  a,
ulint  n 
)
inlinestatic

Gets the nth bit of a ulint.

Parameters
[in]aulint
[in]nnth bit requested
Returns
true if nth bit is 1; 0th bit is defined to be the least significant

◆ ut_bit_set_nth()

static ulint ut_bit_set_nth ( ulint  a,
ulint  n,
bool  val 
)
inlinestatic

Sets the nth bit of a ulint.

Parameters
[in]aulint
[in]nnth bit requested
[in]valvalue for the bit to set
Returns
the ulint with the bit set as requested

◆ ut_uint64_align_down()

static uint64_t ut_uint64_align_down ( uint64_t  n,
ulint  align_no 
)
inlinestatic

Rounds a 64-bit integer downward to a multiple of a power of 2.

Parameters
[in]nnumber to be rounded
[in]align_noalign by this number
Returns
rounded value

◆ ut_uint64_align_up()

static uint64_t ut_uint64_align_up ( uint64_t  n,
ulint  align_no 
)
inlinestatic

Rounds uint64_t upward to a multiple of a power of 2.

Parameters
[in]nnumber to be rounded
[in]align_noalign by this number
Returns
rounded value

◆ ut_ull_create()

constexpr uint64_t ut_ull_create ( uint32_t  high,
uint32_t  low 
)
constexpr

Creates a 64-bit integer out of two 32-bit integers.

Parameters
[in]highhigh-order 32 bits
[in]lowlow-order 32 bits
Returns
created integer