summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/ut0byte.ic
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/include/ut0byte.ic')
-rw-r--r--storage/xtradb/include/ut0byte.ic200
1 files changed, 99 insertions, 101 deletions
diff --git a/storage/xtradb/include/ut0byte.ic b/storage/xtradb/include/ut0byte.ic
index 021a3a15009..e3beed65138 100644
--- a/storage/xtradb/include/ut0byte.ic
+++ b/storage/xtradb/include/ut0byte.ic
@@ -16,21 +16,22 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************************
+/**************************************************************//**
+@file include/ut0byte.ic
Utilities for byte operations
Created 5/30/1994 Heikki Tuuri
*******************************************************************/
-/***********************************************************
-Creates a 64-bit dulint out of two ulints. */
+/*******************************************************//**
+Creates a 64-bit dulint out of two ulints.
+@return created dulint */
UNIV_INLINE
dulint
ut_dulint_create(
/*=============*/
- /* out: created dulint */
- ulint high, /* in: high-order 32 bits */
- ulint low) /* in: low-order 32 bits */
+ ulint high, /*!< in: high-order 32 bits */
+ ulint low) /*!< in: low-order 32 bits */
{
dulint res;
@@ -43,52 +44,52 @@ ut_dulint_create(
return(res);
}
-/***********************************************************
-Gets the high-order 32 bits of a dulint. */
+/*******************************************************//**
+Gets the high-order 32 bits of a dulint.
+@return 32 bits in ulint */
UNIV_INLINE
ulint
ut_dulint_get_high(
/*===============*/
- /* out: 32 bits in ulint */
- dulint d) /* in: dulint */
+ dulint d) /*!< in: dulint */
{
return(d.high);
}
-/***********************************************************
-Gets the low-order 32 bits of a dulint. */
+/*******************************************************//**
+Gets the low-order 32 bits of a dulint.
+@return 32 bits in ulint */
UNIV_INLINE
ulint
ut_dulint_get_low(
/*==============*/
- /* out: 32 bits in ulint */
- dulint d) /* in: dulint */
+ dulint d) /*!< in: dulint */
{
return(d.low);
}
-/***********************************************************
+/*******************************************************//**
Converts a dulint (a struct of 2 ulints) to ib_int64_t, which is a 64-bit
-integer type. */
+integer type.
+@return value in ib_int64_t type */
UNIV_INLINE
ib_int64_t
ut_conv_dulint_to_longlong(
/*=======================*/
- /* out: value in ib_int64_t type */
- dulint d) /* in: dulint */
+ dulint d) /*!< in: dulint */
{
return((ib_int64_t)d.low
+ (((ib_int64_t)d.high) << 32));
}
-/***********************************************************
-Tests if a dulint is zero. */
+/*******************************************************//**
+Tests if a dulint is zero.
+@return TRUE if zero */
UNIV_INLINE
ibool
ut_dulint_is_zero(
/*==============*/
- /* out: TRUE if zero */
- dulint a) /* in: dulint */
+ dulint a) /*!< in: dulint */
{
if ((a.low == 0) && (a.high == 0)) {
@@ -98,16 +99,15 @@ ut_dulint_is_zero(
return(FALSE);
}
-/***********************************************************
-Compares two dulints. */
+/*******************************************************//**
+Compares two dulints.
+@return -1 if a < b, 0 if a == b, 1 if a > b */
UNIV_INLINE
int
ut_dulint_cmp(
/*==========*/
- /* out: -1 if a < b, 0 if a == b,
- 1 if a > b */
- dulint a, /* in: dulint */
- dulint b) /* in: dulint */
+ dulint a, /*!< in: dulint */
+ dulint b) /*!< in: dulint */
{
if (a.high > b.high) {
return(1);
@@ -122,15 +122,15 @@ ut_dulint_cmp(
}
}
-/***********************************************************
-Calculates the max of two dulints. */
+/*******************************************************//**
+Calculates the max of two dulints.
+@return max(a, b) */
UNIV_INLINE
dulint
ut_dulint_get_max(
/*==============*/
- /* out: max(a, b) */
- dulint a, /* in: dulint */
- dulint b) /* in: dulint */
+ dulint a, /*!< in: dulint */
+ dulint b) /*!< in: dulint */
{
if (ut_dulint_cmp(a, b) > 0) {
@@ -140,15 +140,15 @@ ut_dulint_get_max(
return(b);
}
-/***********************************************************
-Calculates the min of two dulints. */
+/*******************************************************//**
+Calculates the min of two dulints.
+@return min(a, b) */
UNIV_INLINE
dulint
ut_dulint_get_min(
/*==============*/
- /* out: min(a, b) */
- dulint a, /* in: dulint */
- dulint b) /* in: dulint */
+ dulint a, /*!< in: dulint */
+ dulint b) /*!< in: dulint */
{
if (ut_dulint_cmp(a, b) > 0) {
@@ -158,15 +158,15 @@ ut_dulint_get_min(
return(a);
}
-/***********************************************************
-Adds a ulint to a dulint. */
+/*******************************************************//**
+Adds a ulint to a dulint.
+@return sum a + b */
UNIV_INLINE
dulint
ut_dulint_add(
/*==========*/
- /* out: sum a + b */
- dulint a, /* in: dulint */
- ulint b) /* in: ulint */
+ dulint a, /*!< in: dulint */
+ ulint b) /*!< in: ulint */
{
if (0xFFFFFFFFUL - b >= a.low) {
a.low += b;
@@ -181,15 +181,15 @@ ut_dulint_add(
return(a);
}
-/***********************************************************
-Subtracts a ulint from a dulint. */
+/*******************************************************//**
+Subtracts a ulint from a dulint.
+@return a - b */
UNIV_INLINE
dulint
ut_dulint_subtract(
/*===============*/
- /* out: a - b */
- dulint a, /* in: dulint */
- ulint b) /* in: ulint, b <= a */
+ dulint a, /*!< in: dulint */
+ ulint b) /*!< in: ulint, b <= a */
{
if (a.low >= b) {
a.low -= b;
@@ -208,17 +208,17 @@ ut_dulint_subtract(
return(a);
}
-/***********************************************************
+/*******************************************************//**
Subtracts a dulint from another. NOTE that the difference must be positive
-and smaller that 4G. */
+and smaller that 4G.
+@return a - b */
UNIV_INLINE
ulint
ut_dulint_minus(
/*============*/
- /* out: a - b */
- dulint a, /* in: dulint; NOTE a must be >= b and at most
+ dulint a, /*!< in: dulint; NOTE a must be >= b and at most
2 to power 32 - 1 greater */
- dulint b) /* in: dulint */
+ dulint b) /*!< in: dulint */
{
ulint diff;
@@ -238,15 +238,15 @@ ut_dulint_minus(
return(diff);
}
-/************************************************************
-Rounds a dulint downward to a multiple of a power of 2. */
+/********************************************************//**
+Rounds a dulint downward to a multiple of a power of 2.
+@return rounded value */
UNIV_INLINE
dulint
ut_dulint_align_down(
/*=================*/
- /* out: rounded value */
- dulint n, /* in: number to be rounded */
- ulint align_no) /* in: align by this number which must be a
+ dulint n, /*!< in: number to be rounded */
+ ulint align_no) /*!< in: align by this number which must be a
power of 2 */
{
ulint low, high;
@@ -262,29 +262,29 @@ ut_dulint_align_down(
return(ut_dulint_create(high, low));
}
-/************************************************************
-Rounds a dulint upward to a multiple of a power of 2. */
+/********************************************************//**
+Rounds a dulint upward to a multiple of a power of 2.
+@return rounded value */
UNIV_INLINE
dulint
ut_dulint_align_up(
/*===============*/
- /* out: rounded value */
- dulint n, /* in: number to be rounded */
- ulint align_no) /* in: align by this number which must be a
+ dulint n, /*!< in: number to be rounded */
+ ulint align_no) /*!< in: align by this number which must be a
power of 2 */
{
return(ut_dulint_align_down(ut_dulint_add(n, align_no - 1), align_no));
}
-/************************************************************
-Rounds ib_uint64_t downward to a multiple of a power of 2. */
+/********************************************************//**
+Rounds ib_uint64_t downward to a multiple of a power of 2.
+@return rounded value */
UNIV_INLINE
ib_uint64_t
ut_uint64_align_down(
/*=================*/
- /* out: rounded value */
- ib_uint64_t n, /* in: number to be rounded */
- ulint align_no) /* in: align by this number
+ ib_uint64_t n, /*!< in: number to be rounded */
+ ulint align_no) /*!< in: align by this number
which must be a power of 2 */
{
ut_ad(align_no > 0);
@@ -293,15 +293,15 @@ ut_uint64_align_down(
return(n & ~((ib_uint64_t) align_no - 1));
}
-/************************************************************
-Rounds ib_uint64_t upward to a multiple of a power of 2. */
+/********************************************************//**
+Rounds ib_uint64_t upward to a multiple of a power of 2.
+@return rounded value */
UNIV_INLINE
ib_uint64_t
ut_uint64_align_up(
/*===============*/
- /* out: rounded value */
- ib_uint64_t n, /* in: number to be rounded */
- ulint align_no) /* in: align by this number
+ ib_uint64_t n, /*!< in: number to be rounded */
+ ulint align_no) /*!< in: align by this number
which must be a power of 2 */
{
ib_uint64_t align_1 = (ib_uint64_t) align_no - 1;
@@ -312,15 +312,15 @@ ut_uint64_align_up(
return((n + align_1) & ~align_1);
}
-/*************************************************************
-The following function rounds up a pointer to the nearest aligned address. */
+/*********************************************************//**
+The following function rounds up a pointer to the nearest aligned address.
+@return aligned pointer */
UNIV_INLINE
void*
ut_align(
/*=====*/
- /* out: aligned pointer */
- void* ptr, /* in: pointer */
- ulint align_no) /* in: align by this number */
+ void* ptr, /*!< in: pointer */
+ ulint align_no) /*!< in: align by this number */
{
ut_ad(align_no > 0);
ut_ad(((align_no - 1) & align_no) == 0);
@@ -331,16 +331,16 @@ ut_align(
return((void*)((((ulint)ptr) + align_no - 1) & ~(align_no - 1)));
}
-/*************************************************************
+/*********************************************************//**
The following function rounds down a pointer to the nearest
-aligned address. */
+aligned address.
+@return aligned pointer */
UNIV_INLINE
void*
ut_align_down(
/*==========*/
- /* out: aligned pointer */
- const void* ptr, /* in: pointer */
- ulint align_no) /* in: align by this number */
+ const void* ptr, /*!< in: pointer */
+ ulint align_no) /*!< in: align by this number */
{
ut_ad(align_no > 0);
ut_ad(((align_no - 1) & align_no) == 0);
@@ -351,17 +351,16 @@ ut_align_down(
return((void*)((((ulint)ptr)) & ~(align_no - 1)));
}
-/*************************************************************
+/*********************************************************//**
The following function computes the offset of a pointer from the nearest
-aligned address. */
+aligned address.
+@return distance from aligned pointer */
UNIV_INLINE
ulint
ut_align_offset(
/*============*/
- /* out: distance from
- aligned pointer */
- const void* ptr, /* in: pointer */
- ulint align_no) /* in: align by this number */
+ const void* ptr, /*!< in: pointer */
+ ulint align_no) /*!< in: align by this number */
{
ut_ad(align_no > 0);
ut_ad(((align_no - 1) & align_no) == 0);
@@ -372,16 +371,15 @@ ut_align_offset(
return(((ulint)ptr) & (align_no - 1));
}
-/*********************************************************************
-Gets the nth bit of a ulint. */
+/*****************************************************************//**
+Gets the nth bit of a ulint.
+@return TRUE if nth bit is 1; 0th bit is defined to be the least significant */
UNIV_INLINE
ibool
ut_bit_get_nth(
/*===========*/
- /* out: TRUE if nth bit is 1; 0th bit is defined to
- be the least significant */
- ulint a, /* in: ulint */
- ulint n) /* in: nth bit requested */
+ ulint a, /*!< in: ulint */
+ ulint n) /*!< in: nth bit requested */
{
ut_ad(n < 8 * sizeof(ulint));
#if TRUE != 1
@@ -390,16 +388,16 @@ ut_bit_get_nth(
return(1 & (a >> n));
}
-/*********************************************************************
-Sets the nth bit of a ulint. */
+/*****************************************************************//**
+Sets the nth bit of a ulint.
+@return the ulint with the bit set as requested */
UNIV_INLINE
ulint
ut_bit_set_nth(
/*===========*/
- /* out: the ulint with the bit set as requested */
- ulint a, /* in: ulint */
- ulint n, /* in: nth bit requested */
- ibool val) /* in: value for the bit to set */
+ ulint a, /*!< in: ulint */
+ ulint n, /*!< in: nth bit requested */
+ ibool val) /*!< in: value for the bit to set */
{
ut_ad(n < 8 * sizeof(ulint));
#if TRUE != 1