Improve LongHash performance - take #2
This commit is contained in:
parent
0dc2b96f20
commit
a9bcec2567
@ -1,19 +1,28 @@
|
||||
From 0ed4d284bbdfffc523e2c2c731443a31df66de15 Mon Sep 17 00:00:00 2001
|
||||
From 30dee3aef49042baa1609cb2247927bb5dab4710 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <md_5@live.com.au>
|
||||
Date: Fri, 21 Jun 2013 17:13:47 +1000
|
||||
Subject: [PATCH] LongHash Tweaks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
|
||||
index 691cafd..9d54472 100644
|
||||
index 691cafd..7a5801f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/LongHash.java
|
||||
@@ -2,7 +2,7 @@ package org.bukkit.craftbukkit.util;
|
||||
|
||||
public class LongHash {
|
||||
public static long toLong(int msw, int lsw) {
|
||||
- return ((long) msw << 32) + lsw - Integer.MIN_VALUE;
|
||||
+ return ((long) msw << 32) | (lsw & 0xFFFFFFFFL); // Spigot
|
||||
}
|
||||
|
||||
public static int msw(long l) {
|
||||
@@ -10,6 +10,6 @@ public class LongHash {
|
||||
}
|
||||
|
||||
public static int lsw(long l) {
|
||||
- return (int) (l & 0xFFFFFFFF) + Integer.MIN_VALUE;
|
||||
+ return (int) (l) + Integer.MIN_VALUE; // Spigot - remove redundant &
|
||||
+ return (int) (l & 0xFFFFFFFF); // Spigot
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashSet.java
|
||||
@ -220,5 +229,5 @@ index 0000000..9416f6e
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.3.2
|
||||
1.9.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user