| 325 | } |
| 326 | |
| 327 | Result<uint32_t> ExtensionSet::EncodeFunction(Id function_id) { |
| 328 | RETURN_NOT_OK(this->AddUri(function_id)); |
| 329 | auto it_success = |
| 330 | functions_map_.emplace(function_id, static_cast<uint32_t>(functions_map_.size())); |
| 331 | if (it_success.second) { |
| 332 | DCHECK_EQ(functions_.find(static_cast<uint32_t>(functions_.size())), functions_.end()) |
| 333 | << "Function existed in functions_ but not functions_map_. ExtensionSet is " |
| 334 | "inconsistent"; |
| 335 | functions_[static_cast<uint32_t>(functions_.size())] = function_id; |
| 336 | } |
| 337 | return it_success.first->second; |
| 338 | } |
| 339 | |
| 340 | template <typename KeyToIndex, typename Key> |
| 341 | const int* GetIndex(const KeyToIndex& key_to_index, const Key& key) { |