Lines Matching refs:mask

33  * mask. _Flagged_helper::minMask<Flag> is provided to easily calculate a mask for a max value.
53 * provided automatically (flags are automatically shared if possible, e.g. mask is shifted
123 * Calculates the minimum mask required to cover a value. Used with the maximum enum value for
129 * \return mask that can be used that covers the maximum value.
156 * Determines whether mask can be combined with base-mask for a given left shift.
158 * \param mask desired mask
159 * \param baseMask mask used by T or 0 if T is not flagged by Flag
160 * \param sharedMask desired shared mask (if this is non-0, this must be mask & baseMask)
161 * \param shift desired left shift to be used for mask
163 * \param effectiveMask effective mask used by T or 0 if T is not flagged by Flag
165 * \return bool whether mask can be combined with baseMask using the desired values.
169 Flag mask, IntFlag baseMask, Flag sharedMask, int shift,
172 // verify that shift is valid and mask can be shifted
173 shift >= 0 && (mask & topBits<Flag>(shift)) == 0 &&
175 // verify that base mask is part of effective mask (sanity check on arguments)
179 // verify that shared mask is the overlap of base mask and mask
181 ((sharedMask ^ (baseMask & mask)) == 0 &&
185 // otherwise, verify that there is no overlap between mask and base's effective mask
186 (mask & (effectiveMask >> shift)) == 0);
191 * Calculates the minimum (left) shift required to combine a mask with the mask of an
194 * \param mask desired mask
195 * \param baseMask mask used by T or 0 if T is not flagged by Flag
196 * \param sharedMask desired shared mask (if this is non-0, this must be mask & baseMask)
198 * \param effectiveMask effective mask used by T
200 * \return a non-negative minimum left shift value if mask can be combined with baseMask,
206 Flag mask, IntFlag baseMask, Flag sharedMask, int baseShift, IntFlag effectiveMask) {
208 // baseMask must be part of the effective mask
211 // if sharing masks, shift must be base's shift. verify that shared mask is part of
212 // base mask and mask, and that desired mask still fits with base's shift value
214 (canCombine(mask, baseMask, sharedMask, baseShift /* shift */,
218 ((mask & effectiveMask) == 0) ? 0 :
220 // otherwise, verify that mask can be shifted up
221 ((mask & topBits<Flag>(1)) || (mask < 0)) ? -1 :
223 incShift(getShift(Flag(mask << 1), baseMask /* unused */, sharedMask /* 0 */,
248 * \note flagged types do not have a member variable for the mask used by the type. As such,
258 * Type support utility that retrieves the mask of a class (T) if it is a type flagged by
271 static constexpr IntFlag value = Flag(0); ///< mask of a potentially flagged class
273 static constexpr IntFlag effective_value = IntFlag(0); ///<effective mask of flagged class
277 * Type support utility that calculates the minimum (left) shift required to combine a mask
278 * with the mask of an underlying type T also flagged by Flag.
283 * \param MASK desired mask
284 * \param SHARED_MASK desired shared mask (if this is non-0, T must be an type flagged by
285 * Flag with a mask that has exactly these bits common with MASK)
298 * \param MASK desired mask
299 * \param SHARED_MASK desired shared mask (if this is non-0, T MUST be an type flagged by
300 * Flag with a mask that has exactly these bits common with MASK)
308 /// true if this mask can be combined with T's existing flag. false otherwise.
332 * \note We could make SHARED_MASK be a boolean as it must be either 0 or MASK & base's mask, but we
337 * \param MASK mask for the bits used in flag (before any shift)
338 * \param SHARED_MASK optional mask to be shared with T (if this is not zero, SHIFT must be 0, and
339 * it must equal to MASK & T's mask)
340 * \param SHIFT optional left shift for MASK to combine with T's mask (or -1, if masks should not
350 "shared mask can only be used with common flag types "
351 "and must be part of mask and mask of base type");
354 static constexpr Flag sFlagMask = MASK; ///< the mask
367 /// The effective combined mask used by this class and any wrapped classes if the flags are
373 * flags for a particular mask and left shift.
375 * \param mask bitmask to use
380 inline constexpr IntFlag getFlagsHelper(IntFlag mask, int shift) const {
381 return (mFlags >> shift) & mask;
388 * \param mask bitmask to use
393 inline void setFlagsHelper(IntFlag mask, int shift, IntFlag flags) {
394 mFlags = Flag((mFlags & ~(mask << shift)) | ((flags & mask) << shift));
456 static_assert((SHARED_MASK & ~MASK) == 0, "shared mask must be part of the mask");
458 "shared mask must be part of the base mask");
460 "mask and base mask can only overlap in shared mask");
462 static constexpr Flag sFlagMask = MASK; ///< the mask
471 /// The effective combined mask used by this class and any wrapped classes if the flags are