summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/OpenHashMap.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-06-01 13:04:32 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-06-01 13:04:32 +0200
commit6c4414ee36186ee0add924b1655c827ee83d180b (patch)
tree649f37934b3a342006f7eda6b2b1082c5f64526f /src/library/scala/collection/mutable/OpenHashMap.scala
parent8384ebda45724b5a4e47dd2a508ecbbc3bca56f4 (diff)
parent90215ce2b9cb99b5dea7c0ef474eea50755c0a40 (diff)
downloadscala-6c4414ee36186ee0add924b1655c827ee83d180b.tar.gz
scala-6c4414ee36186ee0add924b1655c827ee83d180b.tar.bz2
scala-6c4414ee36186ee0add924b1655c827ee83d180b.zip
Merge commit '90215ce' into merge-2.11-to-2.12-june-1
Diffstat (limited to 'src/library/scala/collection/mutable/OpenHashMap.scala')
-rw-r--r--src/library/scala/collection/mutable/OpenHashMap.scala17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/library/scala/collection/mutable/OpenHashMap.scala b/src/library/scala/collection/mutable/OpenHashMap.scala
index 5bea1634c4..ca08f475ce 100644
--- a/src/library/scala/collection/mutable/OpenHashMap.scala
+++ b/src/library/scala/collection/mutable/OpenHashMap.scala
@@ -115,9 +115,8 @@ extends AbstractMap[Key, Value]
* @param hash hash value for `key`
*/
private[this] def findIndex(key: Key, hash: Int): Int = {
- var j = hash
var index = hash & mask
- var perturb = index
+ var j = 0
/** Index of the first slot containing a deleted entry, or -1 if none found yet. */
var firstDeletedIndex = -1
@@ -130,9 +129,8 @@ extends AbstractMap[Key, Value]
if (firstDeletedIndex == -1 && entry.value == None)
firstDeletedIndex = index
- j = 5 * j + 1 + perturb
- perturb >>= 5
- index = j & mask
+ j += 1
+ index = (index + j) & mask
entry = table(index)
}
@@ -197,20 +195,17 @@ extends AbstractMap[Key, Value]
def get(key : Key) : Option[Value] = {
val hash = hashOf(key)
-
- var j = hash
var index = hash & mask
- var perturb = index
var entry = table(index)
+ var j = 0
while(entry != null){
if (entry.hash == hash &&
entry.key == key){
return entry.value
}
- j = 5 * j + 1 + perturb
- perturb >>= 5
- index = j & mask
+ j += 1
+ index = (index + j) & mask
entry = table(index)
}
None