diff options
| author | Dylan <boss@tehbox.org> | 2026-05-24 22:59:09 +1200 |
|---|---|---|
| committer | Dylan <boss@tehbox.org> | 2026-05-24 22:59:09 +1200 |
| commit | 7711536253315ba3b3628b8c6706573317c7e201 (patch) | |
| tree | f4a78af0d0ffd8cbde88a96361bce4a92b1cefcd /src/HashTable.cpp | |
| parent | 85cd1ecf29c3a295536ccc3782c2415d7518aef0 (diff) | |
| download | tehimage-7711536253315ba3b3628b8c6706573317c7e201.tar.gz tehimage-7711536253315ba3b3628b8c6706573317c7e201.zip | |
feat: Cleanupsv0.0.3PNG-writing
Cleaning up code so its ready for release
Diffstat (limited to 'src/HashTable.cpp')
| -rw-r--r-- | src/HashTable.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/HashTable.cpp b/src/HashTable.cpp index 685dad6..e7da244 100644 --- a/src/HashTable.cpp +++ b/src/HashTable.cpp @@ -15,22 +15,22 @@ namespace TehImage return hash % TABLE_SIZE; } - void HashTable::insert(char key[3], unsigned int value) + void HashTable::insertOrUpdate(char key[3], unsigned int value) { unsigned int index = hashFunction(key); - unsigned int keyMem = 0; - std::memcpy(&keyMem, key, 3); + unsigned int keyValue = 0; + std::memcpy(&keyValue, key, 3); for(auto& pair : table[index]) { - if(pair.first == keyMem) + if(pair.first == keyValue) { pair.second = value; return; } } - table[index].push_back({keyMem, value}); + table[index].push_back({keyValue, value}); } void HashTable::remove(char key[3]) |
