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
28e79349
Unverified
Commit
28e79349
authored
Jun 20, 2020
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support integer and float combination in `mrb_equal()`.
parent
33c8d6af
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
src/object.c
src/object.c
+11
-0
No files found.
src/object.c
View file @
28e79349
...
@@ -47,6 +47,17 @@ mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2)
...
@@ -47,6 +47,17 @@ mrb_equal(mrb_state *mrb, mrb_value obj1, mrb_value obj2)
mrb_value
result
;
mrb_value
result
;
if
(
mrb_obj_eq
(
mrb
,
obj1
,
obj2
))
return
TRUE
;
if
(
mrb_obj_eq
(
mrb
,
obj1
,
obj2
))
return
TRUE
;
#ifndef MRB_WITHOUT_FLOAT
/* value mixing with integer and float */
if
(
mrb_fixnum_p
(
obj1
))
{
if
(
mrb_float_p
(
obj2
)
&&
(
mrb_float
)
mrb_fixnum
(
obj1
)
==
mrb_float
(
obj2
))
return
TRUE
;
}
else
if
(
mrb_float_p
(
obj1
))
{
if
(
mrb_fixnum_p
(
obj2
)
&&
mrb_float
(
obj1
)
==
(
mrb_float
)
mrb_fixnum
(
obj2
))
return
TRUE
;
}
#endif
result
=
mrb_funcall
(
mrb
,
obj1
,
"=="
,
1
,
obj2
);
result
=
mrb_funcall
(
mrb
,
obj1
,
"=="
,
1
,
obj2
);
if
(
mrb_test
(
result
))
return
TRUE
;
if
(
mrb_test
(
result
))
return
TRUE
;
return
FALSE
;
return
FALSE
;
...
...
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