Lines Matching full:mask

26 static inline void snd_mask_none(struct snd_mask *mask)  in snd_mask_none()  argument
28 memset(mask, 0, sizeof(*mask)); in snd_mask_none()
31 static inline void snd_mask_any(struct snd_mask *mask) in snd_mask_any() argument
33 memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t)); in snd_mask_any()
36 static inline int snd_mask_empty(const struct snd_mask *mask) in snd_mask_empty() argument
40 if (mask->bits[i]) in snd_mask_empty()
45 static inline unsigned int snd_mask_min(const struct snd_mask *mask) in snd_mask_min() argument
49 if (mask->bits[i]) in snd_mask_min()
50 return __ffs(mask->bits[i]) + (i << 5); in snd_mask_min()
55 static inline unsigned int snd_mask_max(const struct snd_mask *mask) in snd_mask_max() argument
59 if (mask->bits[i]) in snd_mask_max()
60 return __fls(mask->bits[i]) + (i << 5); in snd_mask_max()
65 static inline void snd_mask_set(struct snd_mask *mask, unsigned int val) in snd_mask_set() argument
67 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); in snd_mask_set()
71 static inline void snd_mask_set_format(struct snd_mask *mask, in snd_mask_set_format() argument
74 snd_mask_set(mask, (__force unsigned int)format); in snd_mask_set_format()
77 static inline void snd_mask_reset(struct snd_mask *mask, unsigned int val) in snd_mask_reset() argument
79 mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val); in snd_mask_reset()
82 static inline void snd_mask_set_range(struct snd_mask *mask, in snd_mask_set_range() argument
87 mask->bits[MASK_OFS(i)] |= MASK_BIT(i); in snd_mask_set_range()
90 static inline void snd_mask_reset_range(struct snd_mask *mask, in snd_mask_reset_range() argument
95 mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i); in snd_mask_reset_range()
98 static inline void snd_mask_leave(struct snd_mask *mask, unsigned int val) in snd_mask_leave() argument
101 v = mask->bits[MASK_OFS(val)] & MASK_BIT(val); in snd_mask_leave()
102 snd_mask_none(mask); in snd_mask_leave()
103 mask->bits[MASK_OFS(val)] = v; in snd_mask_leave()
106 static inline void snd_mask_intersect(struct snd_mask *mask, in snd_mask_intersect() argument
111 mask->bits[i] &= v->bits[i]; in snd_mask_intersect()
114 static inline int snd_mask_eq(const struct snd_mask *mask, in snd_mask_eq() argument
117 return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t)); in snd_mask_eq()
120 static inline void snd_mask_copy(struct snd_mask *mask, in snd_mask_copy() argument
123 *mask = *v; in snd_mask_copy()
126 static inline int snd_mask_test(const struct snd_mask *mask, unsigned int val) in snd_mask_test() argument
128 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); in snd_mask_test()
132 static inline int snd_mask_test_format(const struct snd_mask *mask, in snd_mask_test_format() argument
135 return snd_mask_test(mask, (__force unsigned int)format); in snd_mask_test_format()
138 static inline int snd_mask_single(const struct snd_mask *mask) in snd_mask_single() argument
142 if (! mask->bits[i]) in snd_mask_single()
144 if (mask->bits[i] & (mask->bits[i] - 1)) in snd_mask_single()
153 static inline int snd_mask_refine(struct snd_mask *mask, in snd_mask_refine() argument
157 snd_mask_copy(&old, mask); in snd_mask_refine()
158 snd_mask_intersect(mask, v); in snd_mask_refine()
159 if (snd_mask_empty(mask)) in snd_mask_refine()
161 return !snd_mask_eq(mask, &old); in snd_mask_refine()
164 static inline int snd_mask_refine_first(struct snd_mask *mask) in snd_mask_refine_first() argument
166 if (snd_mask_single(mask)) in snd_mask_refine_first()
168 snd_mask_leave(mask, snd_mask_min(mask)); in snd_mask_refine_first()
172 static inline int snd_mask_refine_last(struct snd_mask *mask) in snd_mask_refine_last() argument
174 if (snd_mask_single(mask)) in snd_mask_refine_last()
176 snd_mask_leave(mask, snd_mask_max(mask)); in snd_mask_refine_last()
180 static inline int snd_mask_refine_min(struct snd_mask *mask, unsigned int val) in snd_mask_refine_min() argument
182 if (snd_mask_min(mask) >= val) in snd_mask_refine_min()
184 snd_mask_reset_range(mask, 0, val - 1); in snd_mask_refine_min()
185 if (snd_mask_empty(mask)) in snd_mask_refine_min()
190 static inline int snd_mask_refine_max(struct snd_mask *mask, unsigned int val) in snd_mask_refine_max() argument
192 if (snd_mask_max(mask) <= val) in snd_mask_refine_max()
194 snd_mask_reset_range(mask, val + 1, SNDRV_MASK_BITS); in snd_mask_refine_max()
195 if (snd_mask_empty(mask)) in snd_mask_refine_max()
200 static inline int snd_mask_refine_set(struct snd_mask *mask, unsigned int val) in snd_mask_refine_set() argument
203 changed = !snd_mask_single(mask); in snd_mask_refine_set()
204 snd_mask_leave(mask, val); in snd_mask_refine_set()
205 if (snd_mask_empty(mask)) in snd_mask_refine_set()
210 static inline int snd_mask_value(const struct snd_mask *mask) in snd_mask_value() argument
212 return snd_mask_min(mask); in snd_mask_value()