MCPcopy Index your code
hub / github.com/clojure/clojure / hasheqFrom

Method hasheqFrom

src/jvm/clojure/lang/Numbers.java:1121–1152  ·  view source on GitHub ↗
(Number x, Class xc)

Source from the content-addressed store, hash-verified

1119}
1120
1121@WarnBoxedMath(false)
1122static int hasheqFrom(Number x, Class xc){
1123 if(xc == Integer.class
1124 || xc == Short.class
1125 || xc == Byte.class
1126 || (xc == BigInteger.class && lte(x, Long.MAX_VALUE) && gte(x,Long.MIN_VALUE)))
1127 {
1128 long lpart = x.longValue();
1129 return Murmur3.hashLong(lpart);
1130 //return (int) (lpart ^ (lpart >>> 32));
1131 }
1132 if(xc == BigDecimal.class)
1133 {
1134 // stripTrailingZeros() to make all numerically equal
1135 // BigDecimal values come out the same before calling
1136 // hashCode. Special check for 0 because
1137 // stripTrailingZeros() does not do anything to values
1138 // equal to 0 with different scales.
1139 if (isZero(x))
1140 return BigDecimal.ZERO.hashCode();
1141 else
1142 {
1143 BigDecimal tmp = ((BigDecimal) x).stripTrailingZeros();
1144 return tmp.hashCode();
1145 }
1146 }
1147 if(xc == Float.class && x.equals(-0.0f))
1148 {
1149 return 0; // match 0.0f
1150 }
1151 return x.hashCode();
1152}
1153
1154@WarnBoxedMath(false)
1155static int hasheq(Number x){

Callers 1

hasheqMethod · 0.95

Calls 7

lteMethod · 0.95
gteMethod · 0.95
hashLongMethod · 0.95
isZeroMethod · 0.95
longValueMethod · 0.45
hashCodeMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected