1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-01 08:00:48 +00:00

Fix poorly distributed hashCode in Position.java

Bitwise shift has lower precedence than addition, so the hashCode calculation was like `(xmin + ymin) << (8 + xmax) << (16 + ymax) << 24` which results in absolutely poor hashCode (in particular, lower 24 bits are always zero).
This commit is contained in:
Tagir Valeev 2022-10-28 11:26:32 +02:00 committed by GitHub
parent ab8d4f4118
commit 35f94e2b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,7 @@ public class Position {
@Override
public int hashCode() {
return xmin + ymin << 8 + xmax << 16 + ymax << 24;
return xmin + (ymin << 8) + (xmax << 16) + (ymax << 24);
}
@Override