MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ParseAndEncodeNumber

Function ParseAndEncodeNumber

source/util/parse_number.cpp:240–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240EncodeNumberStatus ParseAndEncodeNumber(const char* text,
241 const NumberType& type,
242 std::function<void(uint32_t)> emit,
243 std::string* error_msg) {
244 if (!text) {
245 ErrorMsgStream(error_msg) << "The given text is a nullptr";
246 return EncodeNumberStatus::kInvalidText;
247 }
248
249 if (IsUnknown(type)) {
250 ErrorMsgStream(error_msg)
251 << "The expected type is not a integer or float type";
252 return EncodeNumberStatus::kInvalidUsage;
253 }
254
255 // If we explicitly expect a floating-point number, we should handle that
256 // first.
257 if (IsFloating(type)) {
258 return ParseAndEncodeFloatingPointNumber(text, type, emit, error_msg);
259 }
260
261 return ParseAndEncodeIntegerNumber(text, type, emit, error_msg);
262}
263
264} // namespace utils
265} // namespace spvtools

Callers 3

ParseDefaultValueStrFunction · 0.85
TESTFunction · 0.85

Calls 5

ErrorMsgStreamClass · 0.85
IsUnknownFunction · 0.85
IsFloatingFunction · 0.85

Tested by 2

ParseDefaultValueStrFunction · 0.68
TESTFunction · 0.68