Function for finding how many elements from the start of a vector are true.
- Note
- D - shared3p protection domain
-
Supported types - bool
- Returns
- the number of set bits in the longest constant true prefix of the input
- Note
- this function performs log n multiplications on vectors of at most size n this is more efficient than performing n multiplications on scalars
- Leakage
- None
◆ truePrefixLength()
template<domain D :shared3p >
| D uint truePrefixLength |
( |
D bool |
arr | ) |
|
- Parameters
-
| arr | - boolean 1-dimensional vector |