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 @@ -546,13 +546,15 @@ object Names {
546546 private [this ] var size = 1
547547
548548 /** The hash of a name made of from characters cs[offset..offset+len-1]. */
549- private def hashValue (cs : Array [Char ], offset : Int , len : Int ): Int =
550- if (len > 0 )
551- (len * (41 * 41 * 41 ) +
552- cs(offset) * (41 * 41 ) +
553- cs(offset + len - 1 ) * 41 +
554- cs(offset + (len >> 1 )))
555- else 0
549+ private def hashValue (cs : Array [Char ], offset : Int , len : Int ): Int = {
550+ var i = offset
551+ var hash = 0
552+ while (i < len + offset) {
553+ hash = 31 * hash + cs(i)
554+ i += 1
555+ }
556+ hash
557+ }
556558
557559 /** Is (the ASCII representation of) name at given index equal to
558560 * cs[offset..offset+len-1]?
You can’t perform that action at this time.
0 commit comments