SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions
truePrefixLength

Functions

template<domain D :shared3p >
D uint truePrefixLength (D bool[[1]] arr)
 

Detailed Description

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

Function Documentation

◆ truePrefixLength()

D uint truePrefixLength ( D bool[[1]]  arr)
Parameters
arr- boolean 1-dimensional vector