htable32.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010 Université de Bordeaux 1
  4. * Copyright (C) 2010 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __GENERIC_HTABLE_H__
  18. #define __GENERIC_HTABLE_H__
  19. #include <stdint.h>
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include <assert.h>
  23. #define STARPU_HTBL32_NODE_SIZE 16
  24. /* Hierarchical table: all nodes have a 2^16 arity . */
  25. typedef struct starpu_htbl32_node {
  26. unsigned nentries;
  27. struct starpu_htbl32_node *children[1<<STARPU_HTBL32_NODE_SIZE];
  28. } starpu_htbl32_node_t;
  29. /* Look for a 32bit key into the hierchical table. Returns the entry if
  30. * something is found, NULL otherwise. */
  31. void *_starpu_htbl_search_32(struct starpu_htbl32_node *htbl, uint32_t key);
  32. /* Insert an entry indexed by the 32bit key into the hierarchical table.
  33. * Returns the entry that was previously associated to that key if any, NULL
  34. * otherwise. */
  35. void *_starpu_htbl_insert_32(struct starpu_htbl32_node **htbl, uint32_t key, void *entry);
  36. #endif // __GENERIC_HTABLE_H__