htable32.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2010, 2012 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011 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 8
  24. /* Hierarchical table: all nodes have a 2^8 arity . */
  25. /* Note: this struct is used in include/starpu_perfmodel.h */
  26. struct starpu_htbl32_node {
  27. unsigned nentries;
  28. struct starpu_htbl32_node *children[1<<_STARPU_HTBL32_NODE_SIZE];
  29. };
  30. /* Look for a 32bit key into the hierchical table. Returns the entry if
  31. * something is found, NULL otherwise. */
  32. void *_starpu_htbl_search_32(struct starpu_htbl32_node *htbl, uint32_t key);
  33. /* Insert an entry indexed by the 32bit key into the hierarchical table.
  34. * Returns the entry that was previously associated to that key if any, NULL
  35. * otherwise. */
  36. void *_starpu_htbl_insert_32(struct starpu_htbl32_node **htbl, uint32_t key, void *entry);
  37. /* Delete the content of the table, `remove' being called on each element */
  38. void _starpu_htbl_destroy_32(struct starpu_htbl32_node *htbl, void (*remove)(void*));
  39. #endif // __GENERIC_HTABLE_H__