|
Blender V4.3
|
Namespaces | |
| namespace | detail |
| namespace | tests |
Classes | |
| class | BitGroupVector |
| class | BitIterator |
| class | BitIteratorBase |
| class | BitRef |
| class | BitSpan |
| class | BitVector |
| class | BoundedBitSpan |
| class | MutableBitIterator |
| class | MutableBitRef |
| class | MutableBitSpan |
| class | MutableBoundedBitSpan |
Typedefs | |
| using | BitInt = uint64_t |
Functions | |
| bool | or_bools_into_bits (Span< bool > bools, MutableBitSpan r_bits, int64_t allowed_overshoot=0) |
| BitInt | mask_first_n_bits (const int64_t n) |
| BitInt | mask_last_n_bits (const int64_t n) |
| BitInt | mask_range_bits (const int64_t start, const int64_t size) |
| BitInt | mask_single_bit (const int64_t bit_index) |
| BitInt * | int_containing_bit (BitInt *data, const int64_t bit_index) |
| const BitInt * | int_containing_bit (const BitInt *data, const int64_t bit_index) |
| std::ostream & | operator<< (std::ostream &stream, const BitRef &bit) |
| std::ostream & | operator<< (std::ostream &stream, const MutableBitRef &bit) |
| bool | is_bounded_span (const BitSpan span) |
| std::optional< BoundedBitSpan > | try_get_bounded_span (const BitSpan span) |
| template<typename T > | |
| T | to_best_bit_span (const T &data) |
| std::ostream & | operator<< (std::ostream &stream, const BitSpan &span) |
| std::ostream & | operator<< (std::ostream &stream, const MutableBitSpan &span) |
| template<typename ExprFn , typename FirstBitSpanT , typename... BitSpanT> | |
| void | mix_into_first_expr (ExprFn &&expr, FirstBitSpanT &&first_arg, const BitSpanT &...args) |
| template<typename ExprFn , typename FirstBitSpanT , typename... BitSpanT> | |
| bool | any_set_expr (ExprFn &&expr, const FirstBitSpanT &first_arg, const BitSpanT &...args) |
| template<typename ExprFn , typename HandleFn , typename FirstBitSpanT , typename... BitSpanT> | |
| void | foreach_1_index_expr (ExprFn &&expr, HandleFn &&handle, const FirstBitSpanT &first_arg, const BitSpanT &...args) |
| template<typename BitSpanT > | |
| void | invert (BitSpanT &&data) |
| template<typename FirstBitSpanT , typename... BitSpanT> | |
| void | inplace_or (FirstBitSpanT &first_arg, const BitSpanT &...args) |
| template<typename FirstBitSpanT , typename MaskBitSpanT , typename... BitSpanT> | |
| void | inplace_or_masked (FirstBitSpanT &first_arg, const MaskBitSpanT &mask, const BitSpanT &...args) |
| template<typename FirstBitSpanT , typename... BitSpanT> | |
| void | copy_from_or (FirstBitSpanT &first_arg, const BitSpanT &...args) |
| template<typename FirstBitSpanT , typename... BitSpanT> | |
| void | inplace_and (FirstBitSpanT &first_arg, const BitSpanT &...args) |
| template<typename... BitSpanT> | |
| void | operator|= (MutableBitSpan first_arg, const BitSpanT &...args) |
| template<typename... BitSpanT> | |
| void | operator|= (MutableBoundedBitSpan first_arg, const BitSpanT &...args) |
| template<typename... BitSpanT> | |
| void | operator&= (MutableBitSpan first_arg, const BitSpanT &...args) |
| template<typename... BitSpanT> | |
| void | operator&= (MutableBoundedBitSpan first_arg, const BitSpanT &...args) |
| template<typename... BitSpanT> | |
| bool | has_common_set_bits (const BitSpanT &...args) |
| template<typename BitSpanT > | |
| bool | any_bit_set (const BitSpanT &arg) |
| template<typename... BitSpanT> | |
| bool | has_common_unset_bits (const BitSpanT &...args) |
| template<typename BitSpanT > | |
| bool | any_bit_unset (const BitSpanT &arg) |
| template<typename BitSpanT , typename Fn > | |
| void | foreach_1_index (const BitSpanT &data, Fn &&fn) |
| template<typename BitSpanT , typename Fn > | |
| void | foreach_0_index (const BitSpanT &data, Fn &&fn) |
| template<typename BitSpanT1 , typename BitSpanT2 > | |
| bool | spans_equal (const BitSpanT1 &a, const BitSpanT2 &b) |
| template<typename BitSpanT1 , typename BitSpanT2 , typename BitSpanT3 > | |
| bool | spans_equal_masked (const BitSpanT1 &a, const BitSpanT2 &b, const BitSpanT3 &mask) |
| template<typename IntT > | |
| void | bits_to_index_ranges (const BitSpan bits, IndexRangesBuilder< IntT > &builder) |
| template<int64_t InlineBufferCapacity, typename Allocator > | |
| BoundedBitSpan | to_best_bit_span (const BitVector< InlineBufferCapacity, Allocator > &data) |
| template<int64_t InlineBufferCapacity, typename Allocator > | |
| MutableBoundedBitSpan | to_best_bit_span (BitVector< InlineBufferCapacity, Allocator > &data) |
Variables | |
| static constexpr int64_t | BitsPerInt = int64_t(sizeof(BitInt) * 8) |
| static constexpr int64_t | BitToIntIndexShift |
| static constexpr BitInt | BitIndexMask = (BitInt(1) << BitToIntIndexShift) - 1 |
| template<typename... Args> | |
| constexpr bool | all_bounded_spans |
| using blender::bits::BitInt = uint64_t |
Using a large integer type is better because then it's easier to process many bits at once.
Definition at line 28 of file BLI_bit_ref.hh.
|
inline |
Definition at line 257 of file BLI_bit_span_ops.hh.
References has_common_set_bits().
|
inline |
Definition at line 267 of file BLI_bit_span_ops.hh.
References has_common_unset_bits().
|
inline |
Definition at line 177 of file BLI_bit_span_ops.hh.
References blender::bits::detail::any_set_expr(), and to_best_bit_span().
Referenced by has_common_set_bits(), has_common_unset_bits(), spans_equal(), and spans_equal_masked().
|
inline |
Extracts index ranges from the given bits. For example 00111011 would result in two ranges: [2-4], [6-7].
It's especially optimized to handle cases where there are very many or very few set bits.
Definition at line 23 of file BLI_bit_span_to_index_ranges.hh.
References blender::IndexRangesBuilder< T >::add_range(), blender::bits::BitSpan::bit_range(), BitIndexMask, bitscan_forward_uint64(), BitsPerInt, BLI_assert, blender::bits::BitSpan::data(), blender::IndexRange::from_begin_end(), blender::IndexRange::from_begin_size(), int_containing_bit(), blender::bits::BitSpan::is_empty(), blender::IndexRange::last(), mask_first_n_bits(), mask_range_bits(), range, blender::split_index_range_by_alignment(), blender::IndexRange::start(), and UNUSED_VARS_NDEBUG.
Referenced by blender::index_mask::from_bits_batch_predicate(), blender::bits::tests::TEST(), and blender::bits::tests::TEST().
|
inline |
Definition at line 216 of file BLI_bit_span_ops.hh.
References mix_into_first_expr().
Referenced by blender::bits::MutableBitSpan::copy_from(), blender::bits::MutableBitSpan::copy_from(), blender::bits::MutableBoundedBitSpan::copy_from(), blender::bits::MutableBoundedBitSpan::copy_from(), and blender::index_mask::evaluate_exact_with_bits().
|
inline |
Definition at line 277 of file BLI_bit_span_ops.hh.
References data, and foreach_1_index_expr().
Referenced by BKE_subdiv_ccg_foreach_visible_grid_vert(), and blender::ed::sculpt_paint::cloth::calc_visible_vert_indices_grids().
|
inline |
Definition at line 272 of file BLI_bit_span_ops.hh.
References data, foreach_1_index_expr(), and x.
Referenced by blender::bke::anonymous_attribute_inferencing::analyze_anonymous_attribute_usages(), blender::index_mask::bits_to_indices(), blender::ed::sculpt_paint::mask::copy_old_hidden_mask_grids(), blender::bke::get_direct_zone_relations(), blender::bke::anonymous_attribute_inferencing::bNodeTreeToDotOptionsForAnonymousAttributeInferencing::socket_name(), blender::bits::tests::TEST(), and blender::bke::update_zone_per_node().
|
inline |
Definition at line 183 of file BLI_bit_span_ops.hh.
References blender::bits::detail::foreach_1_index_expr(), and to_best_bit_span().
Referenced by foreach_0_index(), and foreach_1_index().
|
inline |
Definition at line 252 of file BLI_bit_span_ops.hh.
References any_set_expr().
Referenced by any_bit_set(), and blender::bke::discover_tree_zones().
|
inline |
Definition at line 262 of file BLI_bit_span_ops.hh.
References any_set_expr().
Referenced by any_bit_unset().
|
inline |
Definition at line 223 of file BLI_bit_span_ops.hh.
References mix_into_first_expr().
Referenced by operator&=(), and operator&=().
|
inline |
Definition at line 198 of file BLI_bit_span_ops.hh.
References mix_into_first_expr().
Referenced by operator|=(), and operator|=().
|
inline |
Definition at line 204 of file BLI_bit_span_ops.hh.
References mask(), and mix_into_first_expr().
Referenced by blender::bke::anonymous_attribute_inferencing::or_into_each_other_masked().
Definition at line 71 of file BLI_bit_ref.hh.
References BitToIntIndexShift.
Referenced by blender::bits::BitRef::BitRef(), bits_to_index_ranges(), blender::bits::MutableBitRef::MutableBitRef(), or_bools_into_bits(), blender::bits::MutableBitSpan::reset_all(), blender::bits::MutableBitSpan::set_all(), and blender::bits::tests::TEST().
|
inline |
Definition at line 76 of file BLI_bit_ref.hh.
References BitToIntIndexShift.
|
inline |
Definition at line 192 of file BLI_bit_span_ops.hh.
References data, and mix_into_first_expr().
Referenced by blender::ed::sculpt_paint::expand::enabled_state_to_bitmap(), blender::index_mask::IndexMask::from_bools_inverse(), blender::ed::sculpt_paint::hide::invert_visibility_grids(), and blender::index_mask::tests::TEST().
|
inline |
Checks if the span fulfills the requirements for a bounded span. Bounded spans can often be processed more efficiently, because fewer cases have to be considered when aligning multiple such spans.
See comments in the function for the exact requirements.
Don't allow small sized spans to cross BitInt boundaries.
Definition at line 152 of file BLI_bit_span.hh.
References blender::bits::BitSpan::bit_range(), BitsPerInt, blender::bits::BitSpan::size(), and blender::IndexRange::start().
Referenced by blender::bits::BoundedBitSpan::BoundedBitSpan(), blender::bits::BoundedBitSpan::BoundedBitSpan(), blender::bits::BoundedBitSpan::BoundedBitSpan(), blender::bits::MutableBoundedBitSpan::MutableBoundedBitSpan(), blender::bits::MutableBoundedBitSpan::MutableBoundedBitSpan(), blender::bits::MutableBoundedBitSpan::MutableBoundedBitSpan(), blender::bits::tests::TEST(), and try_get_bounded_span().
Definition at line 37 of file BLI_bit_ref.hh.
References BitsPerInt, and BLI_assert.
Referenced by blender::bits::detail::any_set_expr(), bits_to_index_ranges(), blender::bits::detail::foreach_1_index_expr(), blender::bits::MutableBitSpan::reset_all(), blender::bits::MutableBitSpan::set_all(), and blender::bits::tests::TEST().
Definition at line 47 of file BLI_bit_ref.hh.
References BitsPerInt.
Referenced by mask_range_bits(), and blender::bits::tests::TEST().
Definition at line 52 of file BLI_bit_ref.hh.
References BitsPerInt, BLI_assert, mask_last_n_bits(), and size().
Referenced by bits_to_index_ranges(), blender::bits::detail::mix_into_first_expr(), blender::bits::MutableBitSpan::reset_all(), blender::bits::MutableBitSpan::set_all(), and blender::bits::tests::TEST().
Definition at line 64 of file BLI_bit_ref.hh.
References BitsPerInt, and BLI_assert.
Referenced by blender::bits::BitRef::BitRef(), blender::bits::MutableBitRef::MutableBitRef(), and blender::bits::tests::TEST().
|
inline |
Definition at line 171 of file BLI_bit_span_ops.hh.
References blender::bits::detail::mix_into_first_expr(), and to_best_bit_span().
Referenced by copy_from_or(), blender::index_mask::evaluate_exact_with_bits(), inplace_and(), inplace_or(), inplace_or_masked(), and invert().
|
inline |
Definition at line 241 of file BLI_bit_span_ops.hh.
References inplace_and().
|
inline |
Definition at line 247 of file BLI_bit_span_ops.hh.
References inplace_and().
| std::ostream & blender::bits::operator<< | ( | std::ostream & | stream, |
| const BitRef & | bit ) |
Definition at line 11 of file bit_ref.cc.
| std::ostream & blender::bits::operator<< | ( | std::ostream & | stream, |
| const BitSpan & | span ) |
Definition at line 86 of file bit_span.cc.
References blender::bits::BitSpan::size().
| std::ostream & blender::bits::operator<< | ( | std::ostream & | stream, |
| const MutableBitRef & | bit ) |
Definition at line 16 of file bit_ref.cc.
| std::ostream & blender::bits::operator<< | ( | std::ostream & | stream, |
| const MutableBitSpan & | span ) |
Definition at line 96 of file bit_span.cc.
|
inline |
Definition at line 229 of file BLI_bit_span_ops.hh.
References inplace_or().
|
inline |
Definition at line 235 of file BLI_bit_span_ops.hh.
References inplace_or().
| bool blender::bits::or_bools_into_bits | ( | Span< bool > | bools, |
| MutableBitSpan | r_bits, | ||
| int64_t | allowed_overshoot = 0 ) |
Converts the bools to bits and ors them into the given bits. For pure conversion, the bits should therefore be zero initialized before they are passed into this function.
| allowed_overshoot | How many bools/bits can be read/written after the end of the given spans. This can help with performance because the internal algorithm can process many elements at once. |
Definition at line 11 of file bit_bool_conversion.cc.
References blender::bits::MutableBitSpan::bit_range(), BitIndexMask, BitsPerInt, BLI_assert, blender::bits::MutableBitSpan::data(), blender::Span< T >::data(), int_containing_bit(), blender::Span< T >::is_empty(), blender::bits::MutableBitSpan::size(), blender::Span< T >::size(), and blender::IndexRange::start().
Referenced by blender::index_mask::IndexMask::from_bools(), and blender::bits::tests::TEST().
|
inline |
Definition at line 283 of file BLI_bit_span_ops.hh.
References any_set_expr(), and b.
Referenced by blender::bke::anonymous_attribute_inferencing::or_into_each_other().
|
inline |
Definition at line 292 of file BLI_bit_span_ops.hh.
References any_set_expr(), b, BLI_assert, and mask().
Referenced by blender::bke::anonymous_attribute_inferencing::or_into_each_other_masked().
|
inline |
Definition at line 395 of file BLI_bit_vector.hh.
References data.
|
inline |
Definition at line 389 of file BLI_bit_vector.hh.
References data.
Overloaded in BLI_bit_vector.hh. The purpose is to make passing #BitVector into bit span operations more efficient (interpreting it as BoundedBitSpan instead of just BitSpan).
Definition at line 390 of file BLI_bit_span.hh.
References data, and blender::is_same_any_v.
Referenced by any_set_expr(), foreach_1_index_expr(), and mix_into_first_expr().
|
inline |
Definition at line 374 of file BLI_bit_span.hh.
References blender::bits::BitSpan::bit_range(), BitsPerInt, BitToIntIndexShift, blender::bits::BitSpan::data(), is_bounded_span(), blender::bits::BitSpan::size(), and blender::IndexRange::start().
|
constexpr |
Definition at line 401 of file BLI_bit_span.hh.
Referenced by blender::bits::detail::any_set_expr(), blender::bits::detail::foreach_1_index_expr(), and blender::bits::detail::mix_into_first_expr().
|
staticconstexpr |
Bit mask containing a 1 for the last few bits that index a bit inside of an BitInt.
Definition at line 35 of file BLI_bit_ref.hh.
Referenced by blender::bits::BitRef::BitRef(), bits_to_index_ranges(), blender::bits::BoundedBitSpan::final_bits_num(), blender::bits::MutableBoundedBitSpan::final_bits_num(), blender::bits::MutableBitRef::MutableBitRef(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::operator[](), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::operator[](), or_bools_into_bits(), blender::bits::MutableBitSpan::reset_all(), and blender::bits::MutableBitSpan::set_all().
Number of bits that fit into BitInt.
Definition at line 30 of file BLI_bit_ref.hh.
Referenced by bits_to_index_ranges(), blender::bits::BitVector< InlineBufferCapacity, Allocator >::BitVector(), blender::ed::sculpt_paint::expand::enabled_state_to_bitmap(), blender::index_mask::evaluate_exact_with_bits(), is_bounded_span(), mask_first_n_bits(), mask_last_n_bits(), mask_range_bits(), mask_single_bit(), or_bools_into_bits(), blender::bits::MutableBitSpan::reset_all(), blender::bits::MutableBitSpan::set_all(), blender::bits::tests::TEST(), blender::bits::tests::TEST(), blender::bits::tests::TEST(), blender::bits::tests::TEST(), and try_get_bounded_span().
|
staticconstexpr |
Shift amount to get from a bit index to an int index. Equivalent to log(BitsPerInt, 2).
Definition at line 32 of file BLI_bit_ref.hh.
Referenced by blender::bits::detail::foreach_1_index_expr(), blender::bits::BoundedBitSpan::full_ints_num(), blender::bits::MutableBoundedBitSpan::full_ints_num(), int_containing_bit(), int_containing_bit(), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::operator[](), blender::bits::BitGroupVector< InlineBufferCapacity, Allocator >::operator[](), and try_get_bounded_span().