Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
1168959c
Commit
1168959c
authored
May 28, 2007
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define an auxiliary macro UT_BITS_IN_BYTES() and use it where possible.
parent
aa2ef745
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
11 deletions
+16
-11
dict/dict0dict.c
dict/dict0dict.c
+1
-1
fsp/fsp0fsp.c
fsp/fsp0fsp.c
+2
-3
ibuf/ibuf0ibuf.c
ibuf/ibuf0ibuf.c
+2
-1
include/ut0ut.h
include/ut0ut.h
+5
-0
rem/rem0rec.c
rem/rem0rec.c
+6
-6
No files found.
dict/dict0dict.c
View file @
1168959c
...
@@ -3716,7 +3716,7 @@ dict_index_calc_min_rec_len(
...
@@ -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
);
}
}
...
...
fsp/fsp0fsp.c
View file @
1168959c
...
@@ -205,10 +205,9 @@ the extent are free and which contain old tuple version to clean. */
...
@@ -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)
...
...
ibuf/ibuf0ibuf.c
View file @
1168959c
...
@@ -565,7 +565,8 @@ ibuf_bitmap_page_init(
...
@@ -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
);
...
...
include/ut0ut.h
View file @
1168959c
...
@@ -121,6 +121,11 @@ ut_2_power_up(
...
@@ -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. */
...
...
rem/rem0rec.c
View file @
1168959c
...
@@ -189,7 +189,7 @@ rec_init_offsets(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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(
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment