| 1119 | } |
| 1120 | |
| 1121 | @WarnBoxedMath(false) |
| 1122 | static 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) |
| 1155 | static int hasheq(Number x){ |