Fix libsnark dependency build.
This changes libsnark to build in-place, instead of copying first to a build directory. Previously, modifications made to the original sources wouldn't get rebuilt without a 'make clean' because users would be pointing to the copies. This closes #2689.
This commit is contained in:
37
src/snark/libsnark/algebra/curves/curve_utils.tcc
Normal file
37
src/snark/libsnark/algebra/curves/curve_utils.tcc
Normal file
@@ -0,0 +1,37 @@
|
||||
/** @file
|
||||
*****************************************************************************
|
||||
* @author This file is part of libsnark, developed by SCIPR Lab
|
||||
* and contributors (see AUTHORS).
|
||||
* @copyright MIT license (see LICENSE file)
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CURVE_UTILS_TCC_
|
||||
#define CURVE_UTILS_TCC_
|
||||
|
||||
namespace libsnark {
|
||||
|
||||
template<typename GroupT, mp_size_t m>
|
||||
GroupT scalar_mul(const GroupT &base, const bigint<m> &scalar)
|
||||
{
|
||||
GroupT result = GroupT::zero();
|
||||
|
||||
bool found_one = false;
|
||||
for (long i = scalar.max_bits() - 1; i >= 0; --i)
|
||||
{
|
||||
if (found_one)
|
||||
{
|
||||
result = result.dbl();
|
||||
}
|
||||
|
||||
if (scalar.test_bit(i))
|
||||
{
|
||||
found_one = true;
|
||||
result = result + base;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // libsnark
|
||||
#endif // CURVE_UTILS_TCC_
|
||||
Reference in New Issue
Block a user