From a9bcec256756f459b951b8e1a8c0a9ef875b9568 Mon Sep 17 00:00:00 2001 From: Antony Riley Date: Mon, 9 Jun 2014 17:52:31 +1000 Subject: [PATCH] Improve LongHash performance - take #2 --- CraftBukkit-Patches/0010-LongHash-Tweaks.patch | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch index 1fb76e2c84..ffd7d25bad 100644 --- a/CraftBukkit-Patches/0010-LongHash-Tweaks.patch +++ b/CraftBukkit-Patches/0010-LongHash-Tweaks.patch @@ -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 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