| 120 | } |
| 121 | |
| 122 | bool Add(FixedString key, ValueType const & value) |
| 123 | { |
| 124 | if (!key) return false; |
| 125 | |
| 126 | auto * item = &HashTable[(uint64_t)key.Str % HashSize]; |
| 127 | while (*item != nullptr) { |
| 128 | if (strcmp(key.Str, (*item)->Key.Str) == 0) { |
| 129 | (*item)->Value = value; |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 | item = &(*item)->Next; |
| 134 | } |
| 135 | |
| 136 | auto node = GameAlloc<Node>(); |
| 137 | node->Next = nullptr; |
| 138 | node->Key = key; |
| 139 | node->Value = value; |
| 140 | *item = node; |
| 141 | return true; |
| 142 | } |
| 143 | |
| 144 | ValueType * Find(char const * str) const |
| 145 | { |
nothing calls this directly
no outgoing calls
no test coverage detected