KDE/app/src/main/cpp/Hash.h
Kevin Trogant 2806eb6d71 Initial commit
What works?
- Reading files (AssetManager::loadFile)
- Rendering colored & textured rects (Renderer::addRect)
- Getting input (TouchInputEvent)

TODO
Port this to windows
2022-10-17 16:04:56 +02:00

34 lines
622 B
C++

#ifndef KRIMI_DINNER_ENGINE_HASH_H
#define KRIMI_DINNER_ENGINE_HASH_H
#include <stdint.h>
static constexpr uint64_t HASH_EMPTY_KEY = 0;
static constexpr uint64_t HASH_TOMBSTONE_KEY = 1;
class Hash
{
public:
Hash();
Hash(uint32_t bucket_count);
Hash(const Hash& copy);
Hash& operator=(const Hash& rhs);
~Hash();
uint64_t lookup(uint64_t key, uint64_t default_value);
bool insert(uint64_t key, uint64_t value);
void remove(uint64_t key);
private:
uint32_t m_bucket_count;
uint32_t m_used_buckets;
uint64_t* m_keys;
uint64_t* m_values;
};
using nt_hash = Hash;
#endif