Change enum class to plain enum
This commit is contained in:
parent
31d5d48812
commit
033d3ef22c
@ -797,7 +797,7 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant)
|
|||||||
|
|
||||||
spvutils::HexFloat<spvutils::FloatProxy<float>> fVal(f16);
|
spvutils::HexFloat<spvutils::FloatProxy<float>> fVal(f16);
|
||||||
spvutils::HexFloat<spvutils::FloatProxy<spvutils::Float16>> f16Val(0);
|
spvutils::HexFloat<spvutils::FloatProxy<spvutils::Float16>> f16Val(0);
|
||||||
fVal.castTo(f16Val, spvutils::round_direction::kToZero);
|
fVal.castTo(f16Val, spvutils::kRoundToZero);
|
||||||
|
|
||||||
unsigned value = f16Val.value().getAsFloat().get_value();
|
unsigned value = f16Val.value().getAsFloat().get_value();
|
||||||
|
|
||||||
|
|||||||
@ -226,12 +226,11 @@ struct HexFloatTraits<FloatProxy<Float16>> {
|
|||||||
static const uint_type exponent_bias = 15;
|
static const uint_type exponent_bias = 15;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class round_direction {
|
enum round_direction {
|
||||||
kToZero,
|
kRoundToZero,
|
||||||
kToNearestEven,
|
kRoundToNearestEven,
|
||||||
kToPositiveInfinity,
|
kRoundToPositiveInfinity,
|
||||||
kToNegativeInfinity,
|
kRoundToNegativeInfinity
|
||||||
max = kToNegativeInfinity
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Template class that houses a floating pointer number.
|
// Template class that houses a floating pointer number.
|
||||||
@ -520,15 +519,15 @@ class HexFloat {
|
|||||||
// We actually have to narrow the significand here, so we have to follow the
|
// We actually have to narrow the significand here, so we have to follow the
|
||||||
// rounding rules.
|
// rounding rules.
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case round_direction::kToZero:
|
case kRoundToZero:
|
||||||
break;
|
break;
|
||||||
case round_direction::kToPositiveInfinity:
|
case kRoundToPositiveInfinity:
|
||||||
round_away_from_zero = !isNegative();
|
round_away_from_zero = !isNegative();
|
||||||
break;
|
break;
|
||||||
case round_direction::kToNegativeInfinity:
|
case kRoundToNegativeInfinity:
|
||||||
round_away_from_zero = isNegative();
|
round_away_from_zero = isNegative();
|
||||||
break;
|
break;
|
||||||
case round_direction::kToNearestEven:
|
case kRoundToNearestEven:
|
||||||
// Have to round down, round bit is 0
|
// Have to round down, round bit is 0
|
||||||
if ((first_rounded_bit & significand) == 0) {
|
if ((first_rounded_bit & significand) == 0) {
|
||||||
break;
|
break;
|
||||||
@ -623,8 +622,8 @@ class HexFloat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool round_underflow_up =
|
bool round_underflow_up =
|
||||||
isNegative() ? round_dir == round_direction::kToNegativeInfinity
|
isNegative() ? round_dir == kRoundToNegativeInfinity
|
||||||
: round_dir == round_direction::kToPositiveInfinity;
|
: round_dir == kRoundToPositiveInfinity;
|
||||||
using other_int_type = typename other_T::int_type;
|
using other_int_type = typename other_T::int_type;
|
||||||
// setFromSignUnbiasedExponentAndNormalizedSignificand will
|
// setFromSignUnbiasedExponentAndNormalizedSignificand will
|
||||||
// zero out any underflowing value (but retain the sign).
|
// zero out any underflowing value (but retain the sign).
|
||||||
@ -812,7 +811,7 @@ ParseNormalFloat<FloatProxy<Float16>, HexFloatTraits<FloatProxy<Float16>>>(
|
|||||||
|
|
||||||
// Then convert to 16-bit float, saturating at infinities, and
|
// Then convert to 16-bit float, saturating at infinities, and
|
||||||
// rounding toward zero.
|
// rounding toward zero.
|
||||||
float_val.castTo(value, round_direction::kToZero);
|
float_val.castTo(value, kRoundToZero);
|
||||||
|
|
||||||
// Overflow on 16-bit behaves the same as for 32- and 64-bit: set the
|
// Overflow on 16-bit behaves the same as for 32- and 64-bit: set the
|
||||||
// fail bit and set the lowest or highest value.
|
// fail bit and set the lowest or highest value.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user