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/ut0ut.ic
23
Created 5/30/1994 Heikki Tuuri
24
*******************************************************************/
26
/******************************************************//**
27
Calculates the minimum of two ulints.
33
ulint n1, /*!< in: first number */
34
ulint n2) /*!< in: second number */
36
return((n1 <= n2) ? n1 : n2);
39
/******************************************************//**
40
Calculates the maximum of two ulints.
46
ulint n1, /*!< in: first number */
47
ulint n2) /*!< in: second number */
49
return((n1 <= n2) ? n2 : n1);
52
/****************************************************************//**
53
Calculates minimum of two ulint-pairs. */
58
ulint* a, /*!< out: more significant part of minimum */
59
ulint* b, /*!< out: less significant part of minimum */
60
ulint a1, /*!< in: more significant part of first pair */
61
ulint b1, /*!< in: less significant part of first pair */
62
ulint a2, /*!< in: more significant part of second pair */
63
ulint b2) /*!< in: less significant part of second pair */
77
/******************************************************//**
79
@return 1 if a > b, 0 if a == b, -1 if a < b */
84
ulint a, /*!< in: ulint */
85
ulint b) /*!< in: ulint */
96
/*******************************************************//**
97
Compares two pairs of ulints.
98
@return -1 if a < b, 0 if a == b, 1 if a > b */
103
ulint a1, /*!< in: more significant part of first pair */
104
ulint a2, /*!< in: less significant part of first pair */
105
ulint b1, /*!< in: more significant part of second pair */
106
ulint b2) /*!< in: less significant part of second pair */
110
} else if (a1 < b1) {
112
} else if (a2 > b2) {
114
} else if (a2 < b2) {
121
/*************************************************************//**
122
Calculates fast the 2-logarithm of a number, rounded upward to an
124
@return logarithm in the base 2, rounded upward */
129
ulint n) /*!< in: number != 0 */
152
/*************************************************************//**
153
Calculates 2 to power n.
154
@return 2 to power n */
159
ulint n) /*!< in: number */
161
return((ulint) 1 << n);