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

Function GetLineLengthWithoutColor

source/disassemble.cpp:600–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598}
599
600uint32_t GetLineLengthWithoutColor(const std::string line) {
601 // Currently, every added color is in the form \x1b...m, so instead of doing a
602 // lot of string comparisons with spvtools::clr::* strings, we just ignore
603 // those ranges.
604 uint32_t length = 0;
605 for (size_t i = 0; i < line.size(); ++i) {
606 if (line[i] == '\x1b') {
607 do {
608 ++i;
609 } while (i < line.size() && line[i] != 'm');
610 continue;
611 }
612
613 ++length;
614 }
615
616 return length;
617}
618
619constexpr int kStandardIndent = 15;
620constexpr int kBlockNestIndent = 2;

Callers 1

EmitInstructionImplMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected