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

Function GetRemappedId

source/opt/compact_ids_pass.cpp:28–39  ·  view source on GitHub ↗

Returns the remapped id of |id| from |result_id_mapping|. If the remapped id does not exist, adds a new one to |result_id_mapping| and returns it.

Source from the content-addressed store, hash-verified

26// Returns the remapped id of |id| from |result_id_mapping|. If the remapped
27// id does not exist, adds a new one to |result_id_mapping| and returns it.
28uint32_t GetRemappedId(
29 std::unordered_map<uint32_t, uint32_t>* result_id_mapping, uint32_t id) {
30 auto it = result_id_mapping->find(id);
31 if (it == result_id_mapping->end()) {
32 const uint32_t new_id =
33 static_cast<uint32_t>(result_id_mapping->size()) + 1;
34 const auto insertion_result = result_id_mapping->emplace(id, new_id);
35 it = insertion_result.first;
36 assert(insertion_result.second);
37 }
38 return it->second;
39}
40
41} // namespace
42

Callers 1

ProcessMethod · 0.85

Calls 2

endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected