1
/******************************************************************
4
(c) 1994, 1995 Innobase Oy
6
Created 5/30/1994 Heikki Tuuri
7
*******************************************************************/
9
/**********************************************************
10
Calculates the minimum of two ulints. */
16
ulint n1, /* in: first number */
17
ulint n2) /* in: second number */
19
return((n1 <= n2) ? n1 : n2);
22
/**********************************************************
23
Calculates the maximum of two ulints. */
29
ulint n1, /* in: first number */
30
ulint n2) /* in: second number */
32
return((n1 <= n2) ? n2 : n1);
35
/********************************************************************
36
Calculates minimum of two ulint-pairs. */
41
ulint* a, /* out: more significant part of minimum */
42
ulint* b, /* out: less significant part of minimum */
43
ulint a1, /* in: more significant part of first pair */
44
ulint b1, /* in: less significant part of first pair */
45
ulint a2, /* in: more significant part of second pair */
46
ulint b2) /* in: less significant part of second pair */
60
/**********************************************************
61
Compares two ulints. */
66
/* out: 1 if a > b, 0 if a == b, -1 if a < b */
67
ulint a, /* in: ulint */
68
ulint b) /* in: ulint */
79
/***********************************************************
80
Compares two pairs of ulints. */
85
/* out: -1 if a < b, 0 if a == b, 1 if a > b */
86
ulint a1, /* in: more significant part of first pair */
87
ulint a2, /* in: less significant part of first pair */
88
ulint b1, /* in: more significant part of second pair */
89
ulint b2) /* in: less significant part of second pair */
104
/*****************************************************************
105
Calculates fast the remainder when divided by a power of two. */
109
/*==============*/ /* out: remainder */
110
ulint n, /* in: number to be divided */
111
ulint m) /* in: divisor; power of 2 */
113
ut_ad(0x80000000UL % m == 0);
118
/*****************************************************************
119
Calculates fast a value rounded to a multiple of a power of 2. */
123
/*==========*/ /* out: value of n rounded down to nearest
125
ulint n, /* in: number to be rounded */
126
ulint m) /* in: divisor; power of 2 */
128
ut_ad(0x80000000UL % m == 0);
130
return(n & ~(m - 1));
133
/*****************************************************************
134
Calculates fast the 2-logarithm of a number, rounded upward to an
140
/* out: logarithm in the base 2, rounded upward */
141
ulint n) /* in: number != 0 */
164
/*****************************************************************
165
Calculates 2 to power n. */
170
/* out: 2 to power n */
171
ulint n) /* in: number */
173
return((ulint) 1 << n);