mirror of
https://github.com/MariaDB/server.git
synced 2025-01-28 01:34:17 +01:00
Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
This commit is contained in:
parent
aa2ef7454a
commit
1168959c78
5 changed files with 16 additions and 11 deletions
|
@ -3716,7 +3716,7 @@ dict_index_calc_min_rec_len(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* round the NULL flags up to full bytes */
|
/* round the NULL flags up to full bytes */
|
||||||
sum += (nullable + 7) / 8;
|
sum += UT_BITS_IN_BYTES(nullable);
|
||||||
|
|
||||||
return(sum);
|
return(sum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,10 +205,9 @@ the extent are free and which contain old tuple version to clean. */
|
||||||
space */
|
space */
|
||||||
#define XDES_FSEG 4 /* extent belongs to a segment */
|
#define XDES_FSEG 4 /* extent belongs to a segment */
|
||||||
|
|
||||||
/* File extent data structure size in bytes. The "+ 7 ) / 8" part in the
|
/* File extent data structure size in bytes. */
|
||||||
definition rounds the number of bytes upward. */
|
|
||||||
#define XDES_SIZE \
|
#define XDES_SIZE \
|
||||||
(XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8)
|
(XDES_BITMAP + UT_BITS_IN_BYTES(FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE))
|
||||||
|
|
||||||
/* Offset of the descriptor array on a descriptor page */
|
/* Offset of the descriptor array on a descriptor page */
|
||||||
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
|
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
|
||||||
|
|
|
@ -565,7 +565,8 @@ ibuf_bitmap_page_init(
|
||||||
|
|
||||||
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
|
bit_offset = XDES_DESCRIBED_PER_PAGE * IBUF_BITS_PER_PAGE;
|
||||||
|
|
||||||
byte_offset = bit_offset / 8 + 1; /* better: (bit_offset + 7) / 8 */
|
byte_offset = bit_offset / 8 + 1;
|
||||||
|
/* better: byte_offset = UT_BITS_IN_BYTES(bit_offset); */
|
||||||
|
|
||||||
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
|
fil_page_set_type(page, FIL_PAGE_IBUF_BITMAP);
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,11 @@ ut_2_power_up(
|
||||||
/* out: first power of 2 which is >= n */
|
/* out: first power of 2 which is >= n */
|
||||||
ulint n) /* in: number != 0 */
|
ulint n) /* in: number != 0 */
|
||||||
__attribute__((const));
|
__attribute__((const));
|
||||||
|
|
||||||
|
/* Determine how many bytes (groups of 8 bits) are needed to
|
||||||
|
store the given number of bits. */
|
||||||
|
#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8)
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Sort function for ulint arrays. */
|
Sort function for ulint arrays. */
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ rec_init_offsets(
|
||||||
}
|
}
|
||||||
|
|
||||||
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
||||||
lens = nulls - (index->n_nullable + 7) / 8;
|
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
offs = 0;
|
offs = 0;
|
||||||
null_mask = 1;
|
null_mask = 1;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ rec_get_converted_size_new(
|
||||||
dtuple_t* dtuple) /* in: data tuple */
|
dtuple_t* dtuple) /* in: data tuple */
|
||||||
{
|
{
|
||||||
ulint size = REC_N_NEW_EXTRA_BYTES
|
ulint size = REC_N_NEW_EXTRA_BYTES
|
||||||
+ (index->n_nullable + 7) / 8;
|
+ UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
ulint i;
|
ulint i;
|
||||||
ulint n_fields;
|
ulint n_fields;
|
||||||
ut_ad(index && dtuple);
|
ut_ad(index && dtuple);
|
||||||
|
@ -586,7 +586,7 @@ rec_set_nth_field_extern_bit_new(
|
||||||
we do not write to log about the change */
|
we do not write to log about the change */
|
||||||
{
|
{
|
||||||
byte* nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
byte* nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
||||||
byte* lens = nulls - (index->n_nullable + 7) / 8;
|
byte* lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
ulint i;
|
ulint i;
|
||||||
ulint n_fields;
|
ulint n_fields;
|
||||||
ulint null_mask = 1;
|
ulint null_mask = 1;
|
||||||
|
@ -875,7 +875,7 @@ rec_convert_dtuple_to_rec_new(
|
||||||
|
|
||||||
/* Calculate the offset of the origin in the physical record.
|
/* Calculate the offset of the origin in the physical record.
|
||||||
We must loop over all fields to do this. */
|
We must loop over all fields to do this. */
|
||||||
rec += (index->n_nullable + 7) / 8;
|
rec += UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
|
|
||||||
for (i = 0; i < n_fields; i++) {
|
for (i = 0; i < n_fields; i++) {
|
||||||
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
|
if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
|
||||||
|
@ -915,7 +915,7 @@ rec_convert_dtuple_to_rec_new(
|
||||||
init:
|
init:
|
||||||
end = rec;
|
end = rec;
|
||||||
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
||||||
lens = nulls - (index->n_nullable + 7) / 8;
|
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
/* clear the SQL-null flags */
|
/* clear the SQL-null flags */
|
||||||
memset (lens + 1, 0, nulls - lens);
|
memset (lens + 1, 0, nulls - lens);
|
||||||
|
|
||||||
|
@ -1172,7 +1172,7 @@ rec_copy_prefix_to_buf(
|
||||||
}
|
}
|
||||||
|
|
||||||
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
|
||||||
lens = nulls - (index->n_nullable + 7) / 8;
|
lens = nulls - UT_BITS_IN_BYTES(index->n_nullable);
|
||||||
UNIV_PREFETCH_R(lens);
|
UNIV_PREFETCH_R(lens);
|
||||||
prefix_len = 0;
|
prefix_len = 0;
|
||||||
null_mask = 1;
|
null_mask = 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue