Template Function lbcrypto::NextPowerOfTwo

Function Documentation

template<typename IntType>
IntType lbcrypto::NextPowerOfTwo(IntType n)

Returns the exponent k such that 2^k is the smallest power of 2 that is greater than or equal to the input number, i.e. ceil(log2(n)).

Parameters

n – is the input value for which the next power of 2 needs to be computed.

Returns

the exponent k of the next power of 2 that is greater than or equal to n.