BLI: Add bit span operations and bounded bit spans #107408

Merged
Hans Goudey merged 5 commits from HooglyBoogly/blender:bit-ops-bounded-spans into main 2023-04-28 15:43:41 +02:00

5 Commits

Author SHA1 Message Date
Hans Goudey 71dbb6c1e1 Remove array modifier change 2023-04-28 09:40:54 -04:00
Hans Goudey cdb4b88459 Fix missing zero initialization 2023-04-28 09:19:19 -04:00
Hans Goudey 720f1fea7f Rename copy from implementation operation 2023-04-28 09:19:07 -04:00
Hans Goudey 0547a660ca Merge branch 'main' into bit-ops-bounded-spans 2023-04-28 09:18:08 -04:00
Hans Goudey 3fdceec4d9 BLI: Add bit span operations and bounded bit spans
This patch is mainly by Jacques Lucke, from the simulation branch.

This commit adds generic expression evaluation for bit spans, helping
to generalize the optimizations that avoid processing a single bit
at a time. Operations like "for each 1 index", "or", and "and" are
already implemented in this pull request. Bits in full integers are
processed 64 at a time, then remaining bits are processed all at once.

Currently this optimized evaluation is only implemented for simpler
bounded bit spans. Bounded bit spans have constraints on their bit
ranges that make them more efficient to process. Large spans must start
at the beginning of the first int, and small spans must start and end
within the first int.

Knowing these constraints at compile time reduces the number of edge
cases in the operations, but mainly allows skipping alignment between
multiple bit with different offsets.
2023-04-27 12:38:02 -04:00