Improve LongHash performance.
This commit is contained in:
parent
27cb8a7e6d
commit
1705259934
@ -1,19 +1,28 @@
|
||||
From 0ed4d284bbdfffc523e2c2c731443a31df66de15 Mon Sep 17 00:00:00 2001
|
||||
From c5c6774c86524fbd298556d556af855679b25223 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..fd0b6f9 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 & 0xFFFFFFFF); // 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);
|
||||
}
|
||||
}
|
||||
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