mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
generate double hashCode: simplify expr (IDEA-103687)
(cherry picked from commit 8796e6596a3e3e142b072d405bbf37071b810c5c)
This commit is contained in:
@@ -407,10 +407,9 @@ public class GenerateEqualsHelper implements Runnable {
|
||||
|
||||
private static void addTempForDoubleInitialization(PsiField field, @NonNls StringBuilder buffer) {
|
||||
buffer.append(" = ");
|
||||
buffer.append("Double.doubleToLongBits(");
|
||||
buffer.append(field.getName());
|
||||
buffer.append(" != +0.0d ? Double.doubleToLongBits(");
|
||||
buffer.append(field.getName());
|
||||
buffer.append(") : 0L;\n");
|
||||
buffer.append(");\n");
|
||||
}
|
||||
|
||||
private String addTempDeclaration(@NonNls StringBuilder buffer, boolean resultDeclarationCompleted) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class Test {
|
||||
result = i;
|
||||
result = 31 * result + a.hashCode();
|
||||
result = 31 * result + (b != null ? b.hashCode() : 0);
|
||||
temp = c != +0.0d ? Double.doubleToLongBits(c) : 0L;
|
||||
temp = Double.doubleToLongBits(c);
|
||||
result = 31 * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class Test {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
final long temp = d != +0.0d ? Double.doubleToLongBits(d) : 0L;
|
||||
final long temp = Double.doubleToLongBits(d);
|
||||
return (int) (temp ^ (temp >>> 32));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user