~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/ut0byte.h

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
};
25
25
 
26
26
/* Zero value for a dulint */
27
 
extern const dulint     ut_dulint_zero;
 
27
extern dulint   ut_dulint_zero;
28
28
 
29
29
/* Maximum value for a dulint */
30
 
extern const dulint     ut_dulint_max;
 
30
extern dulint   ut_dulint_max;
31
31
 
32
32
/***********************************************************
33
33
Creates a 64-bit dulint out of two ulints. */
55
55
                        /* out: 32 bits in ulint */
56
56
        dulint  d);     /* in: dulint */
57
57
/***********************************************************
58
 
Converts a dulint (a struct of 2 ulints) to ib_int64_t, which is a 64-bit
 
58
Converts a dulint (a struct of 2 ulints) to ib_longlong, which is a 64-bit
59
59
integer type. */
60
60
UNIV_INLINE
61
 
ib_int64_t
 
61
ib_longlong
62
62
ut_conv_dulint_to_longlong(
63
63
/*=======================*/
64
 
                        /* out: value in ib_int64_t type */
 
64
                        /* out: value in ib_longlong type */
65
65
        dulint  d);     /* in: dulint */
66
66
/***********************************************************
67
67
Tests if a dulint is zero. */
148
148
        dulint   n,             /* in: number to be rounded */
149
149
        ulint    align_no);     /* in: align by this number which must be a
150
150
                                power of 2 */
151
 
/************************************************************
152
 
Rounds a dulint downward to a multiple of a power of 2. */
153
 
UNIV_INLINE
154
 
ib_uint64_t
155
 
ut_uint64_align_down(
156
 
/*=================*/
157
 
                                        /* out: rounded value */
158
 
        ib_uint64_t      n,             /* in: number to be rounded */
159
 
        ulint            align_no);     /* in: align by this number
160
 
                                        which must be a power of 2 */
161
 
/************************************************************
162
 
Rounds ib_uint64_t upward to a multiple of a power of 2. */
163
 
UNIV_INLINE
164
 
ib_uint64_t
165
 
ut_uint64_align_up(
166
 
/*===============*/
167
 
                                        /* out: rounded value */
168
 
        ib_uint64_t      n,             /* in: number to be rounded */
169
 
        ulint            align_no);     /* in: align by this number
170
 
                                        which must be a power of 2 */
171
151
/***********************************************************
172
152
Increments a dulint variable by 1. */
173
153
#define UT_DULINT_INC(D)\
183
163
Tests if two dulints are equal. */
184
164
#define UT_DULINT_EQ(D1, D2)    (((D1).low == (D2).low)\
185
165
                                                && ((D1).high == (D2).high))
186
 
#ifdef notdefined
187
166
/****************************************************************
188
167
Sort function for dulint arrays. */
189
 
UNIV_INTERN
190
168
void
191
169
ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high);
192
170
/*===============================================================*/
193
 
#endif /* notdefined */
194
 
 
 
171
/************************************************************
 
172
The following function calculates the value of an integer n rounded
 
173
to the least product of align_no which is >= n. align_no has to be a
 
174
power of 2. */
 
175
UNIV_INLINE
 
176
ulint
 
177
ut_calc_align(
 
178
/*==========*/
 
179
                                /* out: rounded value */
 
180
        ulint    n,             /* in: number to be rounded */
 
181
        ulint    align_no);     /* in: align by this number */
 
182
/************************************************************
 
183
The following function calculates the value of an integer n rounded
 
184
to the biggest product of align_no which is <= n. align_no has to be a
 
185
power of 2. */
 
186
UNIV_INLINE
 
187
ulint
 
188
ut_calc_align_down(
 
189
/*===============*/
 
190
                                /* out: rounded value */
 
191
        ulint    n,             /* in: number to be rounded */
 
192
        ulint    align_no);     /* in: align by this number */
195
193
/*************************************************************
196
194
The following function rounds up a pointer to the nearest aligned address. */
197
195
UNIV_INLINE
199
197
ut_align(
200
198
/*=====*/
201
199
                                /* out: aligned pointer */
202
 
        void*   ptr,            /* in: pointer */
 
200
        const void*     ptr,            /* in: pointer */
203
201
        ulint   align_no);      /* in: align by this number */
204
202
/*************************************************************
205
203
The following function rounds down a pointer to the nearest
208
206
void*
209
207
ut_align_down(
210
208
/*==========*/
211
 
                                        /* out: aligned pointer */
 
209
                                /* out: aligned pointer */
212
210
        const void*     ptr,            /* in: pointer */
213
 
        ulint           align_no)       /* in: align by this number */
214
 
                __attribute__((__const__));
 
211
        ulint   align_no)       /* in: align by this number */
 
212
                __attribute__((const));
215
213
/*************************************************************
216
214
The following function computes the offset of a pointer from the nearest
217
215
aligned address. */
223
221
                                        pointer */
224
222
        const void*     ptr,            /* in: pointer */
225
223
        ulint           align_no)       /* in: align by this number */
226
 
                        __attribute__((__const__));
 
224
                        __attribute__((const));
227
225
/*********************************************************************
228
226
Gets the nth bit of a ulint. */
229
227
UNIV_INLINE