46#ifndef HALF_ENABLE_F16C_INTRINSICS
55#define HALF_ENABLE_F16C_INTRINSICS __F16C__
57#if HALF_ENABLE_F16C_INTRINSICS
62namespace Experimental {
72 return (
value | 0x7C00);
85 return (
value + (guardBit & (stickyBit |
value)));
98#if HALF_ENABLE_F16C_INTRINSICS
99 return _mm_cvtsi128_si32(_mm_cvtps_ph(_mm_set_ss(
value), _MM_FROUND_TO_NEAREST_INT));
102 std::memcpy(&fbits, &
value,
sizeof(
float));
104 std::uint16_t sign = (fbits >> 16) & 0x8000;
106 if (fbits >= 0x7F800000)
107 return sign | 0x7C00 | ((fbits > 0x7F800000) ? (0x200 | ((fbits >> 13) & 0x3FF)) : 0);
108 if (fbits >= 0x47800000)
110 if (fbits >= 0x38800000)
111 return GetRoundedValue(sign | (((fbits >> 23) - 112) << 10) | ((fbits >> 13) & 0x3FF), (fbits >> 12) & 1,
112 (fbits & 0xFFF) != 0);
113 if (fbits >= 0x33000000) {
114 int i = 125 - (fbits >> 23);
115 fbits = (fbits & 0x7FFFFF) | 0x800000;
117 (fbits & ((
static_cast<std::uint32_t
>(1) << i) - 1)) != 0);
134#if HALF_ENABLE_F16C_INTRINSICS
135 return _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(
value)));
137 std::uint32_t fbits =
static_cast<std::uint32_t
>(
value & 0x8000) << 16;
138 int abs =
value & 0x7FFF;
140 fbits |= 0x38000000 <<
static_cast<unsigned>(abs >= 0x7C00);
141 for (; abs < 0x400; abs <<= 1, fbits -= 0x800000)
143 fbits +=
static_cast<std::uint32_t
>(abs) << 13;
146 std::memcpy(&out, &fbits,
sizeof(
float));
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
constexpr std::uint16_t GetRoundedValue(std::uint16_t value, int guardBit, int stickyBit)
Round the given half-precision number to the nearest representable value.
constexpr std::uint16_t GetOverflowedValue(std::uint16_t value=0)
Get the half-precision overflow.
std::uint16_t FloatToHalf(float value)
Convert an IEEE single-precision float to half-precision.
float HalfToFloat(std::uint16_t value)
Convert an IEEE half-precision float to single-precision.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...