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

Function GetInf

source/opt/const_folding_rules.cpp:48–63  ·  view source on GitHub ↗

Returns a constants with the value INF of the given type. Only works for 32-bit and 64-bit float point types. Returns |nullptr| if an error occurs.

Source from the content-addressed store, hash-verified

46// Returns a constants with the value INF of the given type. Only works for
47// 32-bit and 64-bit float point types. Returns |nullptr| if an error occurs.
48const analysis::Constant* GetInf(const analysis::Type* type,
49 analysis::ConstantManager* const_mgr) {
50 const analysis::Float* float_type = type->AsFloat();
51 if (float_type == nullptr) {
52 return nullptr;
53 }
54
55 switch (float_type->width()) {
56 case 32:
57 return const_mgr->GetFloatConst(std::numeric_limits<float>::infinity());
58 case 64:
59 return const_mgr->GetDoubleConst(std::numeric_limits<double>::infinity());
60 default:
61 return nullptr;
62 }
63}
64
65// Returns true if |type| is Float or a vector of Float.
66bool HasFloatingPoint(const analysis::Type* type) {

Callers 1

FoldFPScalarDivideByZeroFunction · 0.85

Calls 4

AsFloatMethod · 0.80
GetFloatConstMethod · 0.80
GetDoubleConstMethod · 0.80
widthMethod · 0.45

Tested by

no test coverage detected