| 136 | } |
| 137 | |
| 138 | std::vector<uint32_t> GetWordsFromScalarIntConstant( |
| 139 | const analysis::IntConstant* c) { |
| 140 | assert(c != nullptr); |
| 141 | uint32_t width = c->type()->AsInteger()->width(); |
| 142 | assert(width == 8 || width == 16 || width == 32 || width == 64); |
| 143 | if (width == 64) { |
| 144 | uint64_t uval = static_cast<uint64_t>(c->GetU64()); |
| 145 | return ExtractInts(uval); |
| 146 | } |
| 147 | // Section 2.2.1 of the SPIR-V spec guarantees that all integer types |
| 148 | // smaller than 32-bits are automatically zero or sign extended to 32-bits. |
| 149 | return {c->GetU32BitValue()}; |
| 150 | } |
| 151 | |
| 152 | std::vector<uint32_t> GetWordsFromScalarFloatConstant( |
| 153 | const analysis::FloatConstant* c) { |
no test coverage detected