diff options
Diffstat (limited to 'patches/server/1002-Optimize-Bit-Operations-by-inlining.patch')
-rw-r--r-- | patches/server/1002-Optimize-Bit-Operations-by-inlining.patch | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch index 5823fb0d37..d32c7563e3 100644 --- a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch +++ b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch @@ -7,7 +7,7 @@ Inline bit operations and reduce instruction count to make these hot operations faster diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index d80e3f5f53b9d28dea574cff5c65dfa3f8148f88..70f9e737b3b9f80395afc3542aafe4a0c774c722 100644 +index aa27b96cf64ddbbc630e2c313ebff7636438aee0..70f9e737b3b9f80395afc3542aafe4a0c774c722 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java @@ -36,15 +36,16 @@ public class BlockPos extends Vec3i { @@ -76,15 +76,15 @@ index d80e3f5f53b9d28dea574cff5c65dfa3f8148f88..70f9e737b3b9f80395afc3542aafe4a0 public static long asLong(int x, int y, int z) { - long l = 0L; -- l |= ((long)x & PACKED_X_MASK) << X_OFFSET; -- l |= ((long)y & PACKED_Y_MASK) << 0; -- return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET; +- l |= (x & PACKED_X_MASK) << X_OFFSET; +- l |= (y & PACKED_Y_MASK) << 0; +- return l | (z & PACKED_Z_MASK) << Z_OFFSET; + return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify } public static long getFlatIndex(long y) { diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java -index 27e0d53d5893a13a340deddc93a1128968db7e5b..fe3577e533fb829c85fd4881b1bcca3b70aaf1a5 100644 +index 469e6156704418b6b8f573baee8289726a7a6587..02500dba0c6645add80a73bc837a90331a864652 100644 --- a/src/main/java/net/minecraft/core/SectionPos.java +++ b/src/main/java/net/minecraft/core/SectionPos.java @@ -38,7 +38,7 @@ public class SectionPos extends Vec3i { @@ -180,9 +180,9 @@ index 27e0d53d5893a13a340deddc93a1128968db7e5b..fe3577e533fb829c85fd4881b1bcca3b + public static long asLong(int x, int y, int z) { - long l = 0L; -- l |= ((long)x & 4194303L) << 42; -- l |= ((long)y & 1048575L) << 0; -- return l | ((long)z & 4194303L) << 20; +- l |= (x & 4194303L) << 42; +- l |= (y & 1048575L) << 0; +- return l | (z & 4194303L) << 20; + return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count } |