starpu_bitmap.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2013 Simon Archipoff
  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 __STARPU_BITMAP_H__
  18. #define __STARPU_BITMAP_H__
  19. #ifdef __cplusplus
  20. extern "C"
  21. {
  22. #endif
  23. /**
  24. @defgroup API_Bitmap Bitmap
  25. @brief This is the interface for the bitmap utilities provided by StarPU.
  26. @{
  27. */
  28. /** create a empty starpu_bitmap */
  29. struct starpu_bitmap *starpu_bitmap_create(void) STARPU_ATTRIBUTE_MALLOC;
  30. /** free \p 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. /** @} */
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif