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
a6119b00
Unverified
Commit
a6119b00
authored
Nov 15, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed further wrong condition in overflow detection.
parent
bb1fb2f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
include/mruby/numeric.h
include/mruby/numeric.h
+2
-2
No files found.
include/mruby/numeric.h
View file @
a6119b00
...
@@ -68,7 +68,7 @@ MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
...
@@ -68,7 +68,7 @@ MRB_API mrb_value mrb_num_mul(mrb_state *mrb, mrb_value x, mrb_value y);
#endif
#endif
#endif
#endif
#if
0 && defined
MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
#if
def
MRB_HAVE_TYPE_GENERIC_CHECKED_ARITHMETIC_BUILTINS
static
inline
mrb_bool
static
inline
mrb_bool
mrb_int_add_overflow
(
mrb_int
augend
,
mrb_int
addend
,
mrb_int
*
sum
)
mrb_int_add_overflow
(
mrb_int
augend
,
mrb_int
addend
,
mrb_int
*
sum
)
...
@@ -122,7 +122,7 @@ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
...
@@ -122,7 +122,7 @@ mrb_int_mul_overflow(mrb_int a, mrb_int b, mrb_int *c)
#ifdef MRB_INT32
#ifdef MRB_INT32
int64_t
n
=
(
int64_t
)
a
*
b
;
int64_t
n
=
(
int64_t
)
a
*
b
;
*
c
=
(
mrb_int
)
n
;
*
c
=
(
mrb_int
)
n
;
return
n
>
MRB_INT_MAX
&&
n
<
MRB_INT_MIN
;
return
n
>
MRB_INT_MAX
||
n
<
MRB_INT_MIN
;
#else
/* MRB_INT64 */
#else
/* MRB_INT64 */
if
(
a
>
0
&&
b
>
0
&&
a
>
MRB_INT_MAX
/
b
)
return
TRUE
;
if
(
a
>
0
&&
b
>
0
&&
a
>
MRB_INT_MAX
/
b
)
return
TRUE
;
if
(
a
<
0
&&
b
>
0
&&
a
<
MRB_INT_MIN
/
b
)
return
TRUE
;
if
(
a
<
0
&&
b
>
0
&&
a
<
MRB_INT_MIN
/
b
)
return
TRUE
;
...
...
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