20#define DEFINE_LARGE_CONSTANTS(T) \
21 using Unsigned = typename std::make_unsigned<T>::type; \
22 constexpr T all_ones = static_cast<T>(-1); \
24 static_cast<T>(static_cast<Unsigned>(1) \
25 << (kBitsPerByte * sizeof(T) - 1)); \
27 static_cast<T>(static_cast<Unsigned>(min) - 1); \
28 constexpr T half_min = min / 2; \
29 constexpr T half_max = max / 2;
37 writer.
Write(all_ones);
40 writer.
Write(half_min);
41 writer.
Write(half_max);
44 const intptr_t r = reader.
Read<intptr_t>();
47 const intptr_t read_all_ones = reader.
Read<intptr_t>();
48 EXPECT_EQ(all_ones, read_all_ones);
49 const intptr_t read_min = reader.
Read<intptr_t>();
50 EXPECT_EQ(
min, read_min);
51 const intptr_t read_max = reader.
Read<intptr_t>();
52 EXPECT_EQ(
max, read_max);
53 const intptr_t read_half_min = reader.
Read<intptr_t>();
54 EXPECT_EQ(half_min, read_half_min);
55 const intptr_t read_half_max = reader.
Read<intptr_t>();
56 EXPECT_EQ(half_max, read_half_max);
75 const uintptr_t read_all_ones = reader.
ReadUnsigned<uintptr_t>();
76 EXPECT_EQ(all_ones, read_all_ones);
77 const uintptr_t read_min = reader.
ReadUnsigned<uintptr_t>();
78 EXPECT_EQ(
min, read_min);
79 const uintptr_t read_max = reader.
ReadUnsigned<uintptr_t>();
80 EXPECT_EQ(
max, read_max);
81 const uintptr_t read_half_min = reader.
ReadUnsigned<uintptr_t>();
82 EXPECT_EQ(half_min, read_half_min);
83 const uintptr_t read_half_max = reader.
ReadUnsigned<uintptr_t>();
84 EXPECT_EQ(half_max, read_half_max);
94 writer.
Write(all_ones);
97 writer.
Write(half_min);
98 writer.
Write(half_max);
106 EXPECT_EQ(all_ones, read_all_ones);
108 EXPECT_EQ(
min, read_min);
110 EXPECT_EQ(
max, read_max);
112 EXPECT_EQ(half_min, read_half_min);
114 EXPECT_EQ(half_max, read_half_max);
145 const uintptr_t read_all_ones = reader.
ReadLEB128();
146 EXPECT_EQ(all_ones, read_all_ones);
147 const uintptr_t read_min = reader.
ReadLEB128();
148 EXPECT_EQ(
min, read_min);
149 const uintptr_t read_max = reader.
ReadLEB128();
150 EXPECT_EQ(
max, read_max);
151 const uintptr_t read_half_min = reader.
ReadLEB128();
152 EXPECT_EQ(half_min, read_half_min);
153 const uintptr_t read_half_max = reader.
ReadLEB128();
154 EXPECT_EQ(half_max, read_half_max);
173 const intptr_t read_all_ones = reader.
ReadSLEB128();
174 EXPECT_EQ(all_ones, read_all_ones);
176 EXPECT_EQ(
min, read_min);
178 EXPECT_EQ(
max, read_max);
179 const intptr_t read_half_min = reader.
ReadSLEB128();
180 EXPECT_EQ(half_min, read_half_min);
181 const intptr_t read_half_max = reader.
ReadSLEB128();
182 EXPECT_EQ(half_max, read_half_max);
C::only_if_signed< T, void > WriteSLEB128(T value)
void WriteUnsigned(T value)
DART_FORCE_INLINE intptr_t bytes_written() const
C::only_if_unsigned< T, void > WriteLEB128(T value)
C::only_if_unsigned< T, T > ReadSLEB128()
C::only_if_unsigned< T, T > ReadLEB128()
#define DEFINE_LARGE_CONSTANTS(T)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API bool Read(SkStreamSeekable *src, SkDocumentPage *dstArray, int dstArrayCount, const SkDeserialProcs *=nullptr)
constexpr int16_t kMaxInt16
static constexpr intptr_t kSignedEnd
TEST_CASE(DirectoryCurrent)
static constexpr intptr_t kSignedStart
constexpr int16_t kMinInt16
static constexpr intptr_t kUnsignedEnd
constexpr uint16_t kMaxUint16