32
/** Pair of ulint integers. */
33
typedef struct dulint_struct dulint;
34
/** Type definition for a 64-bit unsigned integer, which works also
35
in 32-bit machines. NOTE! Access the fields only with the accessor
36
functions. This definition appears here only for the compiler to
37
know the size of a dulint. */
39
ulint high; /*!< most significant 32 bits */
40
ulint low; /*!< least significant 32 bits */
43
/** Zero value for a dulint */
44
extern const dulint ut_dulint_zero;
46
/** Maximum value for a dulint */
47
extern const dulint ut_dulint_max;
49
33
/*******************************************************//**
50
Creates a 64-bit dulint out of two ulints.
34
Creates a 64-bit integer out of two 32-bit integers.
51
35
@return created dulint */
56
40
ulint high, /*!< in: high-order 32 bits */
57
ulint low); /*!< in: low-order 32 bits */
58
/*******************************************************//**
59
Gets the high-order 32 bits of a dulint.
60
@return 32 bits in ulint */
65
dulint d); /*!< in: dulint */
66
/*******************************************************//**
67
Gets the low-order 32 bits of a dulint.
68
@return 32 bits in ulint */
73
dulint d); /*!< in: dulint */
74
/*******************************************************//**
75
Converts a dulint (a struct of 2 ulints) to ib_int64_t, which is a 64-bit
77
@return value in ib_int64_t type */
80
ut_conv_dulint_to_longlong(
81
/*=======================*/
82
dulint d); /*!< in: dulint */
83
/*******************************************************//**
84
Tests if a dulint is zero.
85
@return TRUE if zero */
90
dulint a); /*!< in: dulint */
91
/*******************************************************//**
93
@return -1 if a < b, 0 if a == b, 1 if a > b */
98
dulint a, /*!< in: dulint */
99
dulint b); /*!< in: dulint */
100
/*******************************************************//**
101
Calculates the max of two dulints.
107
dulint a, /*!< in: dulint */
108
dulint b); /*!< in: dulint */
109
/*******************************************************//**
110
Calculates the min of two dulints.
116
dulint a, /*!< in: dulint */
117
dulint b); /*!< in: dulint */
118
/*******************************************************//**
119
Adds a ulint to a dulint.
125
dulint a, /*!< in: dulint */
126
ulint b); /*!< in: ulint */
127
/*******************************************************//**
128
Subtracts a ulint from a dulint.
134
dulint a, /*!< in: dulint */
135
ulint b); /*!< in: ulint, b <= a */
136
/*******************************************************//**
137
Subtracts a dulint from another. NOTE that the difference must be positive
144
dulint a, /*!< in: dulint; NOTE a must be >= b and at most
145
2 to power 32 - 1 greater */
146
dulint b); /*!< in: dulint */
147
/********************************************************//**
148
Rounds a dulint downward to a multiple of a power of 2.
149
@return rounded value */
152
ut_dulint_align_down(
153
/*=================*/
154
dulint n, /*!< in: number to be rounded */
155
ulint align_no); /*!< in: align by this number which must be a
157
/********************************************************//**
158
Rounds a dulint upward to a multiple of a power of 2.
159
@return rounded value */
164
dulint n, /*!< in: number to be rounded */
165
ulint align_no); /*!< in: align by this number which must be a
167
/********************************************************//**
168
Rounds a dulint downward to a multiple of a power of 2.
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.
169
46
@return rounded value */
184
61
ib_uint64_t n, /*!< in: number to be rounded */
185
62
ulint align_no); /*!< in: align by this number
186
63
which must be a power of 2 */
187
/*******************************************************//**
188
Increments a dulint variable by 1. */
189
#define UT_DULINT_INC(D)\
191
if ((D).low == 0xFFFFFFFFUL) {\
192
(D).high = (D).high + 1;\
195
(D).low = (D).low + 1;\
198
/*******************************************************//**
199
Tests if two dulints are equal. */
200
#define UT_DULINT_EQ(D1, D2) (((D1).low == (D2).low)\
201
&& ((D1).high == (D2).high))
203
/************************************************************//**
204
Sort function for dulint arrays. */
209
dulint* arr, /*!< in/out: array to be sorted */
210
dulint* aux_arr,/*!< in/out: auxiliary array (same size as arr) */
211
ulint low, /*!< in: low bound of sort interval, inclusive */
212
ulint high); /*!< in: high bound of sort interval, noninclusive */
213
#endif /* notdefined */
215
64
/*********************************************************//**
216
65
The following function rounds up a pointer to the nearest aligned address.
217
66
@return aligned pointer */