int_hashtable.h 636 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. *** :: Int List ::
  3. ***
  4. *** Hashtable for integers
  5. *** used to check duplicates
  6. *** in various asset loaders.
  7. ***
  8. **/
  9. #ifndef int_hashtable_h
  10. #define int_hashtable_h
  11. #include "cengine.h"
  12. #include "data/int_list.h"
  13. typedef struct {
  14. list* keys;
  15. int_list* values;
  16. } int_bucket;
  17. typedef struct {
  18. int_bucket* items;
  19. int table_size;
  20. } int_hashtable;
  21. int int_hashtable_hash(int_hashtable* ht, char* key);
  22. int_hashtable* int_hashtable_new(int size);
  23. void int_hashtable_delete(int_hashtable* ht);
  24. void int_hashtable_set(int_hashtable* ht, char* key, int value);
  25. int int_hashtable_get(int_hashtable* ht, char* key);
  26. #endif