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
c21a094a
Unverified
Commit
c21a094a
authored
Nov 02, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash.c: avoid `mrb_obj_id` to get the hash value if possible.
parent
877e82eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
src/hash.c
src/hash.c
+7
-0
src/object.c
src/object.c
+1
-1
No files found.
src/hash.c
View file @
c21a094a
...
...
@@ -326,8 +326,15 @@ obj_hash_code(mrb_state *mrb, mrb_value key, struct RHash *h)
case
MRB_TT_TRUE
:
case
MRB_TT_FALSE
:
case
MRB_TT_SYMBOL
:
hash_code
=
U32
(
mrb_fixnum
(
key
));
break
;
case
MRB_TT_INTEGER
:
if
(
mrb_fixnum_p
(
key
))
{
hash_code
=
U32
(
mrb_fixnum
(
key
));
break
;
}
#ifndef MRB_NO_FLOAT
/* fall through */
case
MRB_TT_FLOAT
:
#endif
hash_code
=
U32
(
mrb_obj_id
(
key
));
...
...
src/object.c
View file @
c21a094a
...
...
@@ -16,7 +16,7 @@ mrb_obj_eq(mrb_state *mrb, mrb_value v1, mrb_value v2)
{
#if defined(MRB_NAN_BOXING)
return
v1
.
u
==
v2
.
u
;
#elif defined(MRB_
NAN
_BOXING)
#elif defined(MRB_
WORD
_BOXING)
return
v1
.
w
==
v2
.
w
;
#else
/* MRB_NO_BOXING */
if
(
mrb_type
(
v1
)
!=
mrb_type
(
v2
))
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