An emulator, assembler, and disassembler for the Sega Game Gear
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
759 B

  1. /* Copyright (C) 2014-2015 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. Released under the terms of the MIT License. See LICENSE for details. */
  3. #pragma once
  4. #include <stddef.h>
  5. #define hash_table_NEW(node, key, next) \
  6. hash_table_new(offsetof(node, key), offsetof(node, next))
  7. /* Structs */
  8. typedef struct HashNode HashNode;
  9. typedef struct {
  10. HashNode **nodes;
  11. size_t buckets;
  12. size_t key_offset;
  13. size_t next_offset;
  14. } HashTable;
  15. typedef void (*HashFreeCallback)(HashNode*);
  16. /* Functions */
  17. HashTable* hash_table_new(size_t, size_t);
  18. void hash_table_free(HashTable*, HashFreeCallback);
  19. const HashNode* hash_table_find(const HashTable*, const char*);
  20. void hash_table_insert(HashTable*, HashNode*);