@Override public long hash(Block block, int position) { // convert to canonical NaN if necessary return hash(floatToIntBits(intBitsToFloat(block.getInt(position, 0)))); }
@Test public void testNaNHash() { BlockBuilder blockBuilder = new IntArrayBlockBuilder(null, 4); blockBuilder.writeInt(floatToIntBits(Float.NaN)); blockBuilder.writeInt(floatToRawIntBits(Float.NaN)); // the following two are the integer values of a float NaN blockBuilder.writeInt(-0x400000); blockBuilder.writeInt(0x7fc00000); assertEquals(REAL.hash(blockBuilder, 0), REAL.hash(blockBuilder, 1)); assertEquals(REAL.hash(blockBuilder, 0), REAL.hash(blockBuilder, 2)); assertEquals(REAL.hash(blockBuilder, 0), REAL.hash(blockBuilder, 3)); } }
@Override public long hash(Block block, int position) { // convert to canonical NaN if necessary return hash(floatToIntBits(intBitsToFloat(block.getInt(position, 0)))); }