Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
1df355e3
Commit
1df355e3
authored
Mar 18, 2014
by
Masaki Muranaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce implicit type casts.
parent
2f8dbd8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
src/array.c
src/array.c
+5
-3
src/numeric.c
src/numeric.c
+4
-2
No files found.
src/array.c
View file @
1df355e3
...
...
@@ -79,9 +79,9 @@ mrb_ary_new(mrb_state *mrb)
*
*/
static
inline
void
array_copy
(
mrb_value
*
dst
,
const
mrb_value
*
src
,
size_
t
size
)
array_copy
(
mrb_value
*
dst
,
const
mrb_value
*
src
,
mrb_in
t
size
)
{
size_
t
i
;
mrb_in
t
i
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
dst
[
i
]
=
src
[
i
];
...
...
@@ -238,7 +238,9 @@ mrb_ary_s_create(mrb_state *mrb, mrb_value self)
int
len
;
mrb_get_args
(
mrb
,
"*"
,
&
vals
,
&
len
);
return
mrb_ary_new_from_values
(
mrb
,
len
,
vals
);
mrb_assert
(
len
<=
MRB_INT_MAX
);
/* A rare case. So choosed assert() not raise(). */
return
mrb_ary_new_from_values
(
mrb
,
(
mrb_int
)
len
,
vals
);
}
static
void
...
...
src/numeric.c
View file @
1df355e3
...
...
@@ -962,8 +962,9 @@ fix_xor(mrb_state *mrb, mrb_value x)
#define NUMERIC_SHIFT_WIDTH_MAX (MRB_INT_BIT-1)
static
mrb_value
lshift
(
mrb_state
*
mrb
,
mrb_int
val
,
size_
t
width
)
lshift
(
mrb_state
*
mrb
,
mrb_int
val
,
mrb_in
t
width
)
{
mrb_assert
(
width
>=
0
);
if
(
width
>
NUMERIC_SHIFT_WIDTH_MAX
)
{
mrb_raisef
(
mrb
,
E_RANGE_ERROR
,
"width(%S) > (%S:MRB_INT_BIT-1)"
,
mrb_fixnum_value
(
width
),
...
...
@@ -974,8 +975,9 @@ lshift(mrb_state *mrb, mrb_int val, size_t width)
}
static
mrb_value
rshift
(
mrb_int
val
,
size_
t
width
)
rshift
(
mrb_int
val
,
mrb_in
t
width
)
{
mrb_assert
(
width
>=
0
);
if
(
width
>=
NUMERIC_SHIFT_WIDTH_MAX
)
{
if
(
val
<
0
)
{
val
=
-
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