mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8289552: Make intrinsic conversions between bit representations of half precision values and floats
Reviewed-by: kvn, sviswanathan, jbhateja
This commit is contained in:
parent
2586b1a3c1
commit
07946aa49c
19 changed files with 345 additions and 11 deletions
|
@ -1013,7 +1013,7 @@ public final class Float extends Number
|
|||
* @param floatBinary16 the binary16 value to convert to {@code float}
|
||||
* @since 20
|
||||
*/
|
||||
// @IntrinsicCandidate
|
||||
@IntrinsicCandidate
|
||||
public static float float16ToFloat(short floatBinary16) {
|
||||
/*
|
||||
* The binary16 format has 1 sign bit, 5 exponent bits, and 10
|
||||
|
@ -1088,7 +1088,7 @@ public final class Float extends Number
|
|||
* @param f the {@code float} value to convert to binary16
|
||||
* @since 20
|
||||
*/
|
||||
// @IntrinsicCandidate
|
||||
@IntrinsicCandidate
|
||||
public static short floatToFloat16(float f) {
|
||||
int doppel = Float.floatToRawIntBits(f);
|
||||
short sign_bit = (short)((doppel & 0x8000_0000) >> 16);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue