34
34
import static jdk .incubator .vector .Float16Consts .SIGN_BIT_MASK ;
35
35
import static jdk .incubator .vector .Float16Consts .EXP_BIT_MASK ;
36
36
import static jdk .incubator .vector .Float16Consts .SIGNIF_BIT_MASK ;
37
+ import static jdk .incubator .vector .Float16Consts .MAG_BIT_MASK ;
37
38
38
39
import static java .lang .Float .float16ToFloat ;
39
40
import static java .lang .Float .floatToFloat16 ;
@@ -396,7 +397,7 @@ public static Float16 valueOf(double d) {
396
397
}
397
398
long f_signif_bits = doppel & 0x000f_ffff_ffff_ffffL | msb ;
398
399
399
- int PRECISION_DIFF = Double .PRECISION - PRECISION ; // 42
400
+ final int PRECISION_DIFF = Double .PRECISION - PRECISION ; // 42
400
401
// Significand bits as if using rounding to zero (truncation).
401
402
short signif_bits = (short )(f_signif_bits >> (PRECISION_DIFF + expdelta ));
402
403
@@ -774,7 +775,7 @@ public static boolean isInfinite(Float16 f16) {
774
775
* @see Double#isFinite(double)
775
776
*/
776
777
public static boolean isFinite (Float16 f16 ) {
777
- return (float16ToRawShortBits (f16 ) & ( EXP_BIT_MASK | SIGNIF_BIT_MASK ) ) <=
778
+ return (float16ToRawShortBits (f16 ) & MAG_BIT_MASK ) <=
778
779
float16ToRawShortBits (MAX_VALUE );
779
780
}
780
781
@@ -1093,7 +1094,7 @@ public static Float16 min(Float16 a, Float16 b) {
1093
1094
* 2) performing the operation in the wider format
1094
1095
* 3) converting the result from 2) to the narrower format
1095
1096
*
1096
- * For example, this property hold between the formats used for the
1097
+ * For example, this property holds between the formats used for the
1097
1098
* float and double types. Therefore, the following is a valid
1098
1099
* implementation of a float addition:
1099
1100
*
@@ -1477,7 +1478,7 @@ public static Float16 negate(Float16 f16) {
1477
1478
// operation. Therefore, in this case do _not_ use the float
1478
1479
// unary minus as an implementation as that is not guaranteed
1479
1480
// to flip the sign bit of a NaN.
1480
- return shortBitsToFloat16 ((short )(f16 .value ^ ( short ) 0x0000_8000 ));
1481
+ return shortBitsToFloat16 ((short )(f16 .value ^ SIGN_BIT_MASK ));
1481
1482
}
1482
1483
1483
1484
/**
@@ -1495,7 +1496,7 @@ public static Float16 negate(Float16 f16) {
1495
1496
public static Float16 abs (Float16 f16 ) {
1496
1497
// Zero out sign bit. Per IEE 754-2019 section 5.5.1, abs is a
1497
1498
// bit-level operation and not a logical operation.
1498
- return shortBitsToFloat16 ((short )(f16 .value & ( short ) 0x0000_7FFF ));
1499
+ return shortBitsToFloat16 ((short )(f16 .value & MAG_BIT_MASK ));
1499
1500
}
1500
1501
1501
1502
/**
0 commit comments