| 1021 | } |
| 1022 | |
| 1023 | void InstructionDisassembler::EmitMaskOperand(std::ostream& stream, |
| 1024 | const spv_operand_type_t type, |
| 1025 | const uint32_t word) const { |
| 1026 | // Scan the mask from least significant bit to most significant bit. For each |
| 1027 | // set bit, emit the name of that bit. Separate multiple names with '|'. |
| 1028 | uint32_t remaining_word = word; |
| 1029 | uint32_t mask; |
| 1030 | int num_emitted = 0; |
| 1031 | for (mask = 1; remaining_word; mask <<= 1) { |
| 1032 | if (remaining_word & mask) { |
| 1033 | remaining_word ^= mask; |
| 1034 | const spvtools::OperandDesc* entry = nullptr; |
| 1035 | if (spvtools::LookupOperand(type, mask, &entry)) |
| 1036 | assert(false && "should have caught this earlier"); |
| 1037 | if (num_emitted) stream << "|"; |
| 1038 | stream << entry->name().data(); |
| 1039 | num_emitted++; |
| 1040 | } |
| 1041 | } |
| 1042 | if (!num_emitted) { |
| 1043 | // An operand value of 0 was provided, so represent it by the name |
| 1044 | // of the 0 value. In many cases, that's "None". |
| 1045 | const spvtools::OperandDesc* entry = nullptr; |
| 1046 | if (SPV_SUCCESS == spvtools::LookupOperand(type, 0, &entry)) |
| 1047 | stream << entry->name().data(); |
| 1048 | } |
| 1049 | } |
| 1050 | |
| 1051 | void InstructionDisassembler::ResetColor(std::ostream& stream) const { |
| 1052 | if (color_) stream << spvtools::clr::reset{print_}; |
nothing calls this directly
no test coverage detected