1
/*****************************************************************************
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/******************************************************************//**
20
@file include/ut0byte.h
21
Utilities for byte operations
23
Created 1/20/1994 Heikki Tuuri
24
***********************************************************************/
33
/*******************************************************//**
34
Creates a 64-bit integer out of two 32-bit integers.
35
@return created dulint */
40
ulint high, /*!< in: high-order 32 bits */
41
ulint low) /*!< in: low-order 32 bits */
42
__attribute__((const));
44
/********************************************************//**
45
Rounds a 64-bit integer downward to a multiple of a power of 2.
46
@return rounded value */
51
ib_uint64_t n, /*!< in: number to be rounded */
52
ulint align_no); /*!< in: align by this number
53
which must be a power of 2 */
54
/********************************************************//**
55
Rounds ib_uint64_t upward to a multiple of a power of 2.
56
@return rounded value */
61
ib_uint64_t n, /*!< in: number to be rounded */
62
ulint align_no); /*!< in: align by this number
63
which must be a power of 2 */
64
/*********************************************************//**
65
The following function rounds up a pointer to the nearest aligned address.
66
@return aligned pointer */
71
const void* ptr, /*!< in: pointer */
72
ulint align_no); /*!< in: align by this number */
73
/*********************************************************//**
74
The following function rounds down a pointer to the nearest
76
@return aligned pointer */
81
const void* ptr, /*!< in: pointer */
82
ulint align_no) /*!< in: align by this number */
83
__attribute__((const));
84
/*********************************************************//**
85
The following function computes the offset of a pointer from the nearest
87
@return distance from aligned pointer */
92
const void* ptr, /*!< in: pointer */
93
ulint align_no) /*!< in: align by this number */
94
__attribute__((const));
95
/*****************************************************************//**
96
Gets the nth bit of a ulint.
97
@return TRUE if nth bit is 1; 0th bit is defined to be the least significant */
102
ulint a, /*!< in: ulint */
103
ulint n); /*!< in: nth bit requested */
104
/*****************************************************************//**
105
Sets the nth bit of a ulint.
106
@return the ulint with the bit set as requested */
111
ulint a, /*!< in: ulint */
112
ulint n, /*!< in: nth bit requested */
113
ibool val); /*!< in: value for the bit to set */
116
#include "ut0byte.ic"