starpu_bitmap.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. /**
  25. @defgroup API_Bitmap Bitmap
  26. @brief This is the interface for the bitmap utilities provided by StarPU.
  27. @{
  28. */
  29. /** create a empty starpu_bitmap */
  30. struct starpu_bitmap *starpu_bitmap_create(void) STARPU_ATTRIBUTE_MALLOC;
  31. /** free \p b */
  32. void starpu_bitmap_destroy(struct starpu_bitmap *b);
  33. /** set bit \p e in \p b */
  34. void starpu_bitmap_set(struct starpu_bitmap *b, int e);
  35. /** unset bit \p e in \p b */
  36. void starpu_bitmap_unset(struct starpu_bitmap *b, int e);
  37. /** unset all bits in \p b */
  38. void starpu_bitmap_unset_all(struct starpu_bitmap *b);
  39. /** return true iff bit \p e is set in \p b */
  40. int starpu_bitmap_get(struct starpu_bitmap *b, int e);
  41. /** Basically compute \c starpu_bitmap_unset_all(\p a) ; \p a = \p b & \p c; */
  42. void starpu_bitmap_unset_and(struct starpu_bitmap *a, struct starpu_bitmap *b, struct starpu_bitmap *c);
  43. /** Basically compute \p a |= \p b */
  44. void starpu_bitmap_or(struct starpu_bitmap *a, struct starpu_bitmap *b);
  45. /** return 1 iff \p e is set in \p b1 AND \p e is set in \p b2 */
  46. int starpu_bitmap_and_get(struct starpu_bitmap *b1, struct starpu_bitmap *b2, int e);
  47. /** return the number of set bits in \p b */
  48. int starpu_bitmap_cardinal(struct starpu_bitmap *b);
  49. /** return the index of the first set bit of \p b, -1 if none */
  50. int starpu_bitmap_first(struct starpu_bitmap *b);
  51. /** return the position of the last set bit of \p b, -1 if none */
  52. int starpu_bitmap_last(struct starpu_bitmap *b);
  53. /** return the position of set bit right after \p e in \p b, -1 if none */
  54. int starpu_bitmap_next(struct starpu_bitmap *b, int e);
  55. /** todo */
  56. int starpu_bitmap_has_next(struct starpu_bitmap *b, int e);
  57. /** @} */
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif