starpu_bitmap.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2015,2017,2019 CNRS
  4. * Copyright (C) 2013,2016 Université de Bordeaux
  5. * Copyright (C) 2013 Simon Archipoff
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __STARPU_BITMAP_H__
  19. #define __STARPU_BITMAP_H__
  20. /** @defgroup API_Bitmap Bitmap
  21. @brief This is the interface for the bitmap utilities provided by StarPU.
  22. @{
  23. */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /** create a empty starpu_bitmap */
  29. struct starpu_bitmap *starpu_bitmap_create(void) STARPU_ATTRIBUTE_MALLOC;
  30. /** free \b */
  31. void starpu_bitmap_destroy(struct starpu_bitmap *b);
  32. /** set bit \p e in \p b */
  33. void starpu_bitmap_set(struct starpu_bitmap *b, int e);
  34. /** unset bit \p e in \p b */
  35. void starpu_bitmap_unset(struct starpu_bitmap *b, int e);
  36. /** unset all bits in \p b */
  37. void starpu_bitmap_unset_all(struct starpu_bitmap *b);
  38. /** return true iff bit \p e is set in \p b */
  39. int starpu_bitmap_get(struct starpu_bitmap *b, int e);
  40. /** Basically compute \c starpu_bitmap_unset_all(\p a) ; \p a = \p b & \p c; */
  41. void starpu_bitmap_unset_and(struct starpu_bitmap *a, struct starpu_bitmap *b, struct starpu_bitmap *c);
  42. /** Basically compute \p a |= \p b */
  43. void starpu_bitmap_or(struct starpu_bitmap *a, struct starpu_bitmap *b);
  44. /** return 1 iff \p e is set in \p b1 AND \p e is set in \p b2 */
  45. int starpu_bitmap_and_get(struct starpu_bitmap *b1, struct starpu_bitmap *b2, int e);
  46. /** return the number of set bits in \p b */
  47. int starpu_bitmap_cardinal(struct starpu_bitmap *b);
  48. /** return the index of the first set bit of \p b, -1 if none */
  49. int starpu_bitmap_first(struct starpu_bitmap *b);
  50. /** return the position of the last set bit of \p b, -1 if none */
  51. int starpu_bitmap_last(struct starpu_bitmap *b);
  52. /** return the position of set bit right after \p e in \p b, -1 if none */
  53. int starpu_bitmap_next(struct starpu_bitmap *b, int e);
  54. /** todo */
  55. int starpu_bitmap_has_next(struct starpu_bitmap *b, int e);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. /** @} */
  60. #endif