]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/bitmap.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
9 typedef struct Bitmap Bitmap
;
11 Bitmap
*bitmap_new(void);
12 Bitmap
*bitmap_copy(Bitmap
*b
);
13 int bitmap_ensure_allocated(Bitmap
**b
);
14 void bitmap_free(Bitmap
*b
);
16 int bitmap_set(Bitmap
*b
, unsigned n
);
17 void bitmap_unset(Bitmap
*b
, unsigned n
);
18 bool bitmap_isset(Bitmap
*b
, unsigned n
);
19 bool bitmap_isclear(Bitmap
*b
);
20 void bitmap_clear(Bitmap
*b
);
22 bool bitmap_iterate(Bitmap
*b
, Iterator
*i
, unsigned *n
);
24 bool bitmap_equal(Bitmap
*a
, Bitmap
*b
);
26 #define BITMAP_FOREACH(n, b, i) \
27 for ((i).idx = 0; bitmap_iterate((b), &(i), (unsigned*)&(n)); )
29 DEFINE_TRIVIAL_CLEANUP_FUNC(Bitmap
*, bitmap_free
);
31 #define _cleanup_bitmap_free_ _cleanup_(bitmap_freep)