SecreC 2 language 2.9.0 (2026.10)
Language and standard library reference
Loading...
Searching...
No Matches
Functions
truePrefixLength

Functions

template<domain D :shared2p >
D uint truePrefixLength (D bool arr)
 

Detailed Description

Function for finding how many elements from the start of a vector are true.

Note
D - shared2p 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

Function Documentation

◆ truePrefixLength()

template<domain D :shared2p >
D uint truePrefixLength ( D bool  arr)
Parameters
arr- boolean 1-dimensional vector