decode string from words at current position (non-consuming)
| 302 | |
| 303 | // decode string from words at current position (non-consuming) |
| 304 | std::pair<int, std::string> SpirvStream::decodeString() |
| 305 | { |
| 306 | std::string res; |
| 307 | int wordPos = word; |
| 308 | char c; |
| 309 | bool done = false; |
| 310 | |
| 311 | do { |
| 312 | unsigned int content = stream[wordPos]; |
| 313 | for (int charCount = 0; charCount < 4; ++charCount) { |
| 314 | c = content & 0xff; |
| 315 | content >>= 8; |
| 316 | if (c == '\0') { |
| 317 | done = true; |
| 318 | break; |
| 319 | } |
| 320 | res += c; |
| 321 | } |
| 322 | ++wordPos; |
| 323 | } while(! done); |
| 324 | |
| 325 | return std::make_pair(wordPos - word, res); |
| 326 | } |
| 327 | |
| 328 | // return the number of operands consumed by the string |
| 329 | int SpirvStream::disassembleString() |
nothing calls this directly
no outgoing calls
no test coverage detected