Skip to content

Commit 228f778

Browse files
FrottyCopilot
andauthored
Update de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImPrinter.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 672c7fd commit 228f778

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation

de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImPrinter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,12 @@ public static void print(ImVarAccess p, Appendable sb, int indent) {
273273

274274
public static String smallHash(Object g) {
275275
int h = g.hashCode();
276-
// avoid negative hashes
277-
h = h & Integer.MAX_VALUE;
276+
// avoid negative hashes, handle Integer.MIN_VALUE explicitly
277+
if (h == Integer.MIN_VALUE) {
278+
h = 0;
279+
} else {
280+
h = Math.abs(h);
281+
}
278282
// take only the last 3 digits
279283
int v = h % 1000;
280284
return Integer.toString(v);

0 commit comments

Comments
 (0)