diff options
Diffstat (limited to 'src/libnetdata/bitmap/bitmap64.h')
-rw-r--r-- | src/libnetdata/bitmap/bitmap64.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libnetdata/bitmap/bitmap64.h b/src/libnetdata/bitmap/bitmap64.h new file mode 100644 index 000000000..425f3fd20 --- /dev/null +++ b/src/libnetdata/bitmap/bitmap64.h @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_BITMAP64_H +#define NETDATA_BITMAP64_H + +#include <stdbool.h> +#include <stdint.h> +#include <assert.h> + +typedef uint64_t bitmap64_t; + +#define BITMAP64_INITIALIZER 0 + +static inline void bitmap64_set(bitmap64_t *bitmap, int position) +{ + assert(position >= 0 && position < 64); + + *bitmap |= (1ULL << position); +} + +static inline void bitmap64_clear(bitmap64_t *bitmap, int position) +{ + assert(position >= 0 && position < 64); + + *bitmap &= ~(1ULL << position); +} + +static inline bool bitmap64_get(const bitmap64_t *bitmap, int position) +{ + assert(position >= 0 && position < 64); + + return (*bitmap & (1ULL << position)); +} + +#endif // NETDATA_BITMAP64_H |