byte bitsRev = (byte) (Integer.reverse(aByte) >>> (Integer.SIZE - Byte.SIZE));
@Override public Object read(ByteBuffer buff, int tag) { switch (tag) { case TAG_FLOAT_0: return 0f; case TAG_FLOAT_1: return 1f; case TAG_FLOAT_FIXED: return buff.getFloat(); } return Float.intBitsToFloat(Integer.reverse(DataUtils .readVarInt(buff))); }
int probeThree(short element, int removedIndex) { int nextIndex = Integer.reverse(SpreadFunctions.shortSpreadOne(element)); int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); short keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(int element, int removedIndex) { int nextIndex = Integer.reverse(SpreadFunctions.intSpreadOne(element)); int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); int valueAtIndex = this.table[nextIndex]; if (valueAtIndex == element) { return nextIndex; } if (valueAtIndex == EMPTY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (valueAtIndex == REMOVED && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(int element, int removedIndex) { int nextIndex = Integer.reverse(SpreadFunctions.intSpreadOne(element)); int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); int valueAtIndex = this.table[nextIndex]; if (valueAtIndex == element) { return nextIndex; } if (valueAtIndex == EMPTY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (valueAtIndex == REMOVED && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(short element, int removedIndex) { int nextIndex = Integer.reverse(SpreadFunctions.shortSpreadOne(element)); int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); short valueAtIndex = this.table[nextIndex]; if (valueAtIndex == element) { return nextIndex; } if (valueAtIndex == EMPTY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (valueAtIndex == REMOVED && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(float element, int removedIndex) { int nextIndex = (int) SpreadFunctions.floatSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); float keyAtIndex = this.keys[nextIndex]; if (Float.compare(keyAtIndex, element) == 0) { return nextIndex; } if (Float.compare(keyAtIndex, EMPTY_KEY) == 0) { return removedIndex == -1 ? nextIndex : removedIndex; } if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(float element, int removedIndex) { int nextIndex = (int) SpreadFunctions.floatSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); float keyAtIndex = this.keys[nextIndex]; if (Float.compare(keyAtIndex, element) == 0) { return nextIndex; } if (Float.compare(keyAtIndex, EMPTY_KEY) == 0) { return removedIndex == -1 ? nextIndex : removedIndex; } if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(float element, int removedIndex) { int nextIndex = (int) SpreadFunctions.floatSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.floatSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); float keyAtIndex = this.keys[nextIndex]; if (Float.compare(keyAtIndex, element) == 0) { return nextIndex; } if (Float.compare(keyAtIndex, EMPTY_KEY) == 0) { return removedIndex == -1 ? nextIndex : removedIndex; } if (Float.compare(keyAtIndex, REMOVED_KEY) == 0 && removedIndex == -1) { removedIndex = nextIndex; } } }
@Override public Value readValue(ByteBuffer buff, int tag) { switch (tag) { case TAG_FLOAT_0: return ValueFloat.get(0f); case TAG_FLOAT_1: return ValueFloat.get(1f); case TAG_FLOAT_FIXED: return ValueFloat.get(buff.getFloat()); } return ValueFloat.get(Float.intBitsToFloat(Integer.reverse(DataUtils.readVarInt(buff)))); } };
int probeThree(int element, int removedIndex) { int nextIndex = (int) SpreadFunctions.intSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.intSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); int keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(char element, int removedIndex) { int nextIndex = (int) SpreadFunctions.charSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); char keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(short element, int removedIndex) { int nextIndex = (int) SpreadFunctions.shortSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); short keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(short element, int removedIndex) { int nextIndex = (int) SpreadFunctions.shortSpreadOne(element) << 1; int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask((nextIndex >> 1) + spreadTwo) << 1; short keyAtIndex = this.keysValues[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(char element, int removedIndex) { int nextIndex = (int) SpreadFunctions.charSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1; while(true) { nextIndex = this.mask(nextIndex + spreadTwo); char keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(short element, int removedIndex) { int nextIndex = (int) SpreadFunctions.shortSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); short keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(char element, int removedIndex) { int nextIndex = (int) SpreadFunctions.charSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.charSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); char keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
int probeThree(short element, int removedIndex) { int nextIndex = (int) SpreadFunctions.shortSpreadOne(element); int spreadTwo = Integer.reverse(SpreadFunctions.shortSpreadTwo(element)) | 1; while (true) { nextIndex = this.mask(nextIndex + spreadTwo); short keyAtIndex = this.keys[nextIndex]; if (keyAtIndex == element) { return nextIndex; } if (keyAtIndex == EMPTY_KEY) { return removedIndex == -1 ? nextIndex : removedIndex; } if (keyAtIndex == REMOVED_KEY && removedIndex == -1) { removedIndex = nextIndex; } } }
private void write0(DataBuffer buff, float x) { int f = Float.floatToIntBits(x); if (f == FLOAT_ZERO_BITS) { buff.put((byte) TAG_FLOAT_0); } else if (f == FLOAT_ONE_BITS) { buff.put((byte) TAG_FLOAT_1); } else { int value = Integer.reverse(f); if (value >= 0 && value <= DataUtils.COMPRESSED_VAR_INT_MAX) { buff.put((byte) FLOAT).putVarInt(value); } else { buff.put((byte) TAG_FLOAT_FIXED).putFloat(x); } } }
@Override public void write(WriteBuffer buff, Object obj) { if (!(obj instanceof Float)) { super.write(buff, obj); return; } float x = (Float) obj; int f = Float.floatToIntBits(x); if (f == ObjectDataType.FLOAT_ZERO_BITS) { buff.put((byte) TAG_FLOAT_0); } else if (f == ObjectDataType.FLOAT_ONE_BITS) { buff.put((byte) TAG_FLOAT_1); } else { int value = Integer.reverse(f); if (value >= 0 && value <= DataUtils.COMPRESSED_VAR_INT_MAX) { buff.put((byte) TYPE_FLOAT).putVarInt(value); } else { buff.put((byte) TAG_FLOAT_FIXED).putFloat(x); } } }