18#ifndef __VSF_BITMAP_H__
19#define __VSF_BITMAP_H__
53#include "../compiler/compiler.h"
61#define __vsf_bitmap(__name) __name##_bitmap_t
63#define __vsf_declare_bitmap_ex(__name, __bit_size) \
65 __name[((__bit_size) + __optimal_bit_sz - 1) / __optimal_bit_sz];
67#define __vsf_declare_bitmap(__name, __bit_size) \
68 __vsf_declare_bitmap_ex(__vsf_bitmap(__name), __bit_size)
72#define __vsf_bitmap_get0(__bitmap_ptr, __bit) \
73 (((uintalu_t *)__bitmap_ptr)[(__bit) / __optimal_bit_sz] & ((uintalu_t)1 << ((__bit) & __optimal_bit_msk)))
74#define __vsf_bitmap_get1(__bitmap_ptr, __bit, __pbit_val) \
76 *(&(__bit_val)) = __vsf_bitmap_get0(__bitmap_ptr, __bit); \
79#define __vsf_bitmap_set(__bitmap_ptr, __bit) \
81 (__bitmap_ptr)[(__bit) / __optimal_bit_sz] |= \
82 ((uintalu_t)1 << ((__bit) & __optimal_bit_msk)); \
85#define __vsf_bitmap_clear(__bitmap_ptr, __bit) \
87 (__bitmap_ptr)[(__bit) / __optimal_bit_sz] &= \
88 ~((uintalu_t)1 << ((__bit) & __optimal_bit_msk)); \
93#define vsf_bitmap(__name) __vsf_bitmap(__name)
95#define vsf_declare_bitmap(__name, __bit_size) \
96 __vsf_declare_bitmap(__name, __bit_size)
98#define dcl_vsf_bitmap(__name, __bit_size) \
99 vsf_declare_bitmap(__name, __bit_size)
101#define declare_vsf_bitmap(__name, __bit_size) \
102 vsf_declare_bitmap(__name, __bit_size)
104#define vsf_bitmap_get(__bitmap_ptr, __bit, ...) \
105 __PLOOC_EVAL(__vsf_bitmap_get, __VA_ARGS__)((__bitmap_ptr), (__bit), ##__VA_ARGS__)
107#define vsf_bitmap_set(__bitmap_ptr, __bit) \
108 __vsf_bitmap_set((uintalu_t *)(__bitmap_ptr), (__bit))
110#define vsf_bitmap_clear(__bitmap_ptr, __bit) \
111 __vsf_bitmap_clear((uintalu_t *)(__bitmap_ptr), (__bit))
113#define vsf_bitmap_set_range(__bitmap_ptr, __begin_bit, __end_bit) \
114 __vsf_bitmap_range_assign((uintalu_t *)(__bitmap_ptr), (__begin_bit), (__end_bit), 1)
116#define vsf_bitmap_clear_range(__bitmap_ptr, __begin_bit, __end_bit) \
117 __vsf_bitmap_range_assign((uintalu_t *)(__bitmap_ptr), (__begin_bit), (__end_bit), 0)
119#define vsf_bitmap_reset(__bitmap_ptr, __bit_size) \
120 memset(__bitmap_ptr, 0, ((uint_fast32_t)__bit_size + 7) >> 3)
122#define vsf_bitmap_ffz(__bitmap_ptr, __bit_size) \
123 __vsf_bitmap_ffz((uintalu_t *)(__bitmap_ptr), (__bit_size))
125#define vsf_bitmap_ffs(__bitmap_ptr, __bit_size) \
126 __vsf_bitmap_ffs((uintalu_t *)(__bitmap_ptr), (__bit_size))
uint_fast8_t uintalu_t
Definition type.h:88
int int_fast32_t
Definition stdint.h:26
vk_av_control_value_t value
Definition vsf_audio.h:171
int_fast32_t __vsf_bitmap_ffz(uintalu_t *bitmap_ptr, int_fast32_t bit_size)
Definition vsf_bitmap.c:55
int_fast32_t __vsf_bitmap_ffs(uintalu_t *bitmap_ptr, int_fast32_t bit_size)
Definition vsf_bitmap.c:72
void __vsf_bitmap_range_assign(uintalu_t *bitmap_ptr, int_fast32_t begin_bit, int_fast32_t end_bit, int_fast32_t value)
Definition vsf_bitmap.c:36