29 {
30#if 0
31
33 if (
bits % (1 << 24) == 0) {
35 }
36#else
37
38
39 static constexpr int kTestCount = 2 * 255 * 1024 * 8;
41 for (
int i = 0;
i < kTestCount; ++
i) {
42 uint32_t
sign = (
i & 1) << 31;
43 uint32_t exp = ((
i >> 1) & 255) << 23;
44 uint32_t man = ((
i >> 9) & 1023) << 13;
45 uint32_t frac = ((
i >> 19) & 7);
46 uint64_t
bits =
sign | exp | man | ((frac == 0) ? 0 :
47 (frac == 1) ? (1 << 13) - 1
49#endif
50
53#ifndef SK_DEBUG
54
55
56
57
62#endif
63 continue;
64 }
65
69
70
71
73
74 uint32_t s16 = s32 >> 16;
75 uint32_t e16;
76 uint32_t m16;
78
79 e16 = 0;
80 m16 = 0;
81 } else if ((e32 | m32) < 0x38fe'0000) {
82
83 e16 = 0;
84 m16 = 0xffff & sk_bit_cast<uint32_t>(0.5f +
SkBits2Float(e32 | m32));
85 } else if ((e32 | m32) < 0x3880'0000) {
86
87 e16 = 1;
88 m16 = 0;
90
92 m16 = 0;
93 } else {
94
97
98
99 m32 += 0xfff + ((m32>>13)&1);
100
102
103 e16 += (1 << 10);
104 m16 = 0;
105 } else {
106 m16 = m32 >> 13;
107 }
108 }
109
110
111 uint16_t expected = s16 | e16 | m16;
116 }
117}
static constexpr uint32_t kF16_Exp
static constexpr uint32_t kF32_Sign
static constexpr uint32_t kF32_Mant
static constexpr uint32_t kF32_Exp
static constexpr int kF32_Bias
static constexpr int kF16_Bias
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static float SkBits2Float(uint32_t bits)
static constexpr bool SkIsNaN(T x)
static int sign(SkScalar x)
#define REPORTER_ASSERT(r, cond,...)
uint32_t nextBits(unsigned bitCount)
SIN Vec< N, uint16_t > to_half(const Vec< N, float > &x)