Replaced Vector.hashCode with a more reliable method
This commit is contained in:
parent
3f971e42eb
commit
e5db796188
@ -526,16 +526,17 @@ public class Vector implements Cloneable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hash code for this vector. Due to floating point errors, this
|
* Returns a hash code for this vector
|
||||||
* hash code should not be used in hash tables of any sort.
|
|
||||||
*
|
*
|
||||||
* @return hash code
|
* @return hash code
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ((int)Double.doubleToLongBits(x) >> 13) ^
|
int hash = 7;
|
||||||
((int)Double.doubleToLongBits(y) >> 7) ^
|
hash = 79 * hash + (int) (Double.doubleToLongBits(this.x) ^ (Double.doubleToLongBits(this.x) >>> 32));
|
||||||
(int)Double.doubleToLongBits(z);
|
hash = 79 * hash + (int) (Double.doubleToLongBits(this.y) ^ (Double.doubleToLongBits(this.y) >>> 32));
|
||||||
|
hash = 79 * hash + (int) (Double.doubleToLongBits(this.z) ^ (Double.doubleToLongBits(this.z) >>> 32));
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user