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

Method binaryEncodeString

source/text_handler.cpp:328–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328spv_result_t AssemblyContext::binaryEncodeString(const char* value,
329 spv_instruction_t* pInst) {
330 const size_t length = strlen(value);
331 const size_t wordCount = (length / 4) + 1;
332 const size_t oldWordCount = pInst->words.size();
333 const size_t newWordCount = oldWordCount + wordCount;
334
335 // TODO(dneto): We can just defer this check until later.
336 if (newWordCount > SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX) {
337 return diagnostic() << "Instruction too long: more than "
338 << SPV_LIMIT_INSTRUCTION_WORD_COUNT_MAX << " words.";
339 }
340
341 pInst->words.reserve(newWordCount);
342 spvtools::utils::AppendToVector(value, &pInst->words);
343
344 return SPV_SUCCESS;
345}
346
347spv_result_t AssemblyContext::recordTypeDefinition(
348 const spv_instruction_t* pInst) {

Callers 2

spvTextEncodeOperandFunction · 0.80
TEST_PFunction · 0.80

Calls 2

AppendToVectorFunction · 0.85
sizeMethod · 0.45

Tested by 1

TEST_PFunction · 0.64