MCPcopy Create free account
hub / github.com/e2wugui/zeze / equals

Method equals

ZezeJava/ZezeJava/src/main/java/Zeze/Util/BinaryPool.java:103–124  ·  view source on GitHub ↗
(@NotNull Binary b, @NotNull java.nio.ByteBuffer bb, int beginIndex, int endIndex)

Source from the content-addressed store, hash-verified

101 }
102
103 private static boolean equals(@NotNull Binary b, @NotNull java.nio.ByteBuffer bb, int beginIndex, int endIndex) {
104 int n = b.size();
105 if (n != endIndex - beginIndex)
106 return false;
107 var bytes = b.bytesUnsafe();
108 bb.order(ByteOrder.LITTLE_ENDIAN);
109 int i = 0;
110 for (; i + 8 <= n; i += 8) {
111 if (ByteBuffer.ToLong(bytes, i) != bb.getLong(beginIndex + i))
112 return false;
113 }
114 if (i + 4 <= n) {
115 if (ByteBuffer.ToInt(bytes, i) != bb.getInt(beginIndex + i))
116 return false;
117 i += 4;
118 }
119 for (; i < n; i++) {
120 if (bytes[i] != bb.get(beginIndex + i))
121 return false;
122 }
123 return true;
124 }
125}

Callers 1

internMethod · 0.95

Calls 7

ToLongMethod · 0.95
ToIntMethod · 0.95
bytesUnsafeMethod · 0.80
sizeMethod · 0.65
getMethod · 0.65
getLongMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected