File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -221,13 +221,15 @@ object Names {
221
221
private var size = 1
222
222
223
223
/** The hash of a name made of from characters cs[offset..offset+len-1]. */
224
- private def hashValue (cs : Array [Char ], offset : Int , len : Int ): Int =
225
- if (len > 0 )
226
- (len * (41 * 41 * 41 ) +
227
- cs(offset) * (41 * 41 ) +
228
- cs(offset + len - 1 ) * 41 +
229
- cs(offset + (len >> 1 )))
230
- else 0
224
+ private def hashValue (cs : Array [Char ], offset : Int , len : Int ): Int = {
225
+ var i = offset
226
+ var hash = 0
227
+ while (i < len + offset) {
228
+ hash = 31 * hash + cs(i)
229
+ i += 1
230
+ }
231
+ hash
232
+ }
231
233
232
234
/** Is (the ASCII representation of) name at given index equal to
233
235
* cs[offset..offset+len-1]?
You can’t perform that action at this time.
0 commit comments