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
392aff70
Unverified
Commit
392aff70
authored
Jan 02, 2021
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Jenkins One At A Time Hash for `mrb_str_hash()`.
parent
d5536758
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/string.c
src/string.c
+9
-5
No files found.
src/string.c
View file @
392aff70
...
...
@@ -1752,13 +1752,17 @@ mrb_str_hash(mrb_state *mrb, mrb_value str)
struct
RString
*
s
=
mrb_str_ptr
(
str
);
mrb_int
len
=
RSTR_LEN
(
s
);
char
*
p
=
RSTR_PTR
(
s
);
uint32_t
key
=
0
;
uint32_t
hash
=
0
;
while
(
len
--
)
{
key
=
(
key
<<
6
)
+
(
key
<<
16
)
-
key
+
*
p
;
p
++
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
hash
+=
p
[
i
];
hash
+=
(
hash
<<
10
);
hash
^=
(
hash
>>
6
);
}
return
key
+
(
key
>>
5
);
hash
+=
(
hash
<<
3
);
hash
^=
(
hash
>>
11
);
hash
+=
(
hash
<<
15
);
return
hash
;
}
/* 15.2.10.5.20 */
...
...
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