本文整理了Java中java.lang.Float.floatToRawIntBits()
方法的一些代码示例,展示了Float.floatToRawIntBits()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Float.floatToRawIntBits()
方法的具体详情如下:
包路径:java.lang.Float
类名称:Float
方法名:floatToRawIntBits
[英]Returns an integer corresponding to the bits of the given IEEE 754 single precision float value. Not-a-Number (NaN) values are preserved (compare to #floatToIntBits).
[中]返回与给定IEEE 754单精度浮点值的位相对应的整数*保留非数字(NaN)*值(与#floatToIntBits比较)。
代码示例来源:origin: libgdx/libgdx
/** Converts the color from a float ABGR encoding to an int ABGR encoding. The alpha is expanded from 0-254 in the float
* encoding (see {@link #intToFloatColor(int)}) to 0-255, which means converting from int to float and back to int can be
* lossy. */
public static int floatToIntColor (float value) {
int intBits = Float.floatToRawIntBits(value);
intBits |= (int)((intBits >>> 24) * (255f / 254f)) << 24;
return intBits;
}
代码示例来源:origin: libgdx/libgdx
/** Converts the color from a float ABGR encoding to an int ABGR encoding. The alpha is expanded from 0-254 in the float
* encoding (see {@link #intToFloatColor(int)}) to 0-255, which means converting from int to float and back to int can be
* lossy. */
public static int floatToIntColor (float value) {
int intBits = Float.floatToRawIntBits(value);
intBits |= (int)((intBits >>> 24) * (255f / 254f)) << 24;
return intBits;
}
代码示例来源:origin: apache/kafka
@Override
public byte[] serialize(final String topic, final Float data) {
if (data == null)
return null;
long bits = Float.floatToRawIntBits(data);
return new byte[] {
(byte) (bits >>> 24),
(byte) (bits >>> 16),
(byte) (bits >>> 8),
(byte) bits
};
}
代码示例来源:origin: libgdx/libgdx
public static int floatToRawIntBits (float value) {
return Float.floatToRawIntBits(value);
}
代码示例来源:origin: libgdx/libgdx
public static int floatToRawIntBits (float value) {
return Float.floatToRawIntBits(value);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Adds a CONSTANT_Float_info to the constant pool of this symbol table. Does nothing if the
* constant pool already contains a similar item.
*
* @param value a float.
* @return a new or already existing Symbol with the given value.
*/
Symbol addConstantFloat(final float value) {
return addConstantIntegerOrFloat(Symbol.CONSTANT_FLOAT_TAG, Float.floatToRawIntBits(value));
}
代码示例来源:origin: google/guava
@Override
public final Hasher putFloat(float f) {
return putInt(Float.floatToRawIntBits(f));
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setFloat(int index, float value) {
setInt(index, Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public final ByteBuf writeFloat(float value) {
writeInt(Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf writeFloat(float value) {
writeInt(Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
/**
* Sets the specified 32-bit floating point number at the current
* {@code writerIndex} in Little Endian Byte Order and increases
* the {@code writerIndex} by {@code 4} in this buffer.
* If {@code this.writableBytes} is less than {@code 4}, {@link #ensureWritable(int)}
* will be called in an attempt to expand capacity to accommodate.
*/
public ByteBuf writeFloatLE(float value) {
return writeIntLE(Float.floatToRawIntBits(value));
}
代码示例来源:origin: netty/netty
@Override
public final ByteBuf setFloat(int index, float value) {
setInt(index, Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf setFloat(int index, float value) {
setInt(index, Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public ByteBuf writeFloat(float value) {
writeInt(Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
@Override
public CompositeByteBuf writeFloat(float value) {
super.writeInt(Float.floatToRawIntBits(value));
return this;
}
代码示例来源:origin: netty/netty
/**
* Sets the specified 32-bit floating-point number at the specified
* absolute {@code index} in this buffer in Little Endian Byte Order.
* This method does not modify {@code readerIndex} or {@code writerIndex} of
* this buffer.
*
* @throws IndexOutOfBoundsException
* if the specified {@code index} is less than {@code 0} or
* {@code index + 4} is greater than {@code this.capacity}
*/
public ByteBuf setFloatLE(int index, float value) {
return setIntLE(index, Float.floatToRawIntBits(value));
}
代码示例来源:origin: netty/netty
@Override
public CompositeByteBuf setFloat(int index, float value) {
return setInt(index, Float.floatToRawIntBits(value));
}
代码示例来源:origin: prestodb/presto
@ScalarOperator(CAST)
@SqlType(StandardTypes.REAL)
public static long castToReal(@SqlType(StandardTypes.BOOLEAN) boolean value)
{
return value ? floatToRawIntBits(1.0f) : floatToRawIntBits(0.0f);
}
代码示例来源:origin: prestodb/presto
@ScalarOperator(ADD)
@SqlType(StandardTypes.REAL)
public static long add(@SqlType(StandardTypes.REAL) long left, @SqlType(StandardTypes.REAL) long right)
{
return floatToRawIntBits(intBitsToFloat((int) left) + intBitsToFloat((int) right));
}
代码示例来源:origin: prestodb/presto
public static Block createSequenceBlockOfReal(int start, int end)
{
BlockBuilder builder = REAL.createFixedSizeBlockBuilder(end - start);
for (int i = start; i < end; i++) {
REAL.writeLong(builder, floatToRawIntBits((float) i));
}
return builder.build();
}
内容来源于网络,如有侵权,请联系作者删除!