Skip to content

Commit

Permalink
clang formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Aug 29, 2024
1 parent 76548bc commit 91c47a4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
21 changes: 12 additions & 9 deletions include/mulfft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ inline void TwistIFFTUInt(PolynomialInFD<P> &res, const Polynomial<P> &a)
if constexpr (std::is_same_v<typename P::T, uint32_t>)
fftplvl1.execute_reverse_uint(res.data(), a.data());
// if constexpr (std::is_same_v<typename P::T, uint64_t>)
// fftplvl1.execute_reverse_torus64(res.data(), a.data());
// fftplvl1.execute_reverse_torus64(res.data(), a.data());
}
// else if constexpr (std::is_same_v<typename P::T, uint64_t>)
// fftplvl2.execute_reverse_torus64(res.data(), a.data());
// fftplvl2.execute_reverse_torus64(res.data(), a.data());
else
static_assert(false_v<typename P::T>, "Undefined TwistIFFT!");
}
Expand Down Expand Up @@ -316,8 +316,7 @@ inline void PolyMul(Polynomial<P> &res, const Polynomial<P> &a,
}

template <class P>
inline void PolyMulRescaleUnsigned(Polynomial<P> &res,
const Polynomial<P> &a,
inline void PolyMulRescaleUnsigned(Polynomial<P> &res, const Polynomial<P> &a,
const Polynomial<P> &b)
{
// if constexpr (std::is_same_v<typename P::T, uint32_t>) {
Expand Down Expand Up @@ -350,16 +349,20 @@ inline void PolyMulNaive(Polynomial<P> &res, const Polynomial<P> &a,
}

template <class P>
inline void PolyMulNaieveRescaleUnsigned(Polynomial<P> &res, const Polynomial<P> &a,
const Polynomial<P> &b)
inline void PolyMulNaieveRescaleUnsigned(Polynomial<P> &res,
const Polynomial<P> &a,
const Polynomial<P> &b)
{
for (int i = 0; i < P::n; i++) {
__int128_t ri = 0;
for (int j = 0; j <= i; j++)
ri += static_cast<__int128_t>(a[j]) * static_cast<__int128_t>(b[i - j]);
ri += static_cast<__int128_t>(a[j]) *
static_cast<__int128_t>(b[i - j]);
for (int j = i + 1; j < P::n; j++)
ri -= static_cast<__int128_t>(a[j]) * static_cast<__int128_t>(b[P::n + i - j]);
// res[i] = static_cast<typename P::T>((ri) >> (std::numeric_limits<typename P::T>::digits - 3));
ri -= static_cast<__int128_t>(a[j]) *
static_cast<__int128_t>(b[P::n + i - j]);
// res[i] = static_cast<typename P::T>((ri) >>
// (std::numeric_limits<typename P::T>::digits - 3));
res[i] = static_cast<typename P::T>((ri) >> 29);
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/params/CGGI16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
2 changes: 1 addition & 1 deletion include/params/CGGI19.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
2 changes: 1 addition & 1 deletion include/params/compress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
2 changes: 1 addition & 1 deletion include/params/concrete.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
2 changes: 1 addition & 1 deletion include/params/ternary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
2 changes: 1 addition & 1 deletion include/params/tfhe-rs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ struct lvl20param {
using targetP = lvl0param;
};

//Dummy
// Dummy
struct lvl2hparam {
static constexpr std::uint32_t t = 7; // number of addition in keyswitching
static constexpr std::uint32_t basebit =
Expand Down
4 changes: 3 additions & 1 deletion include/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class AlignedAllocator {
AlignedAllocator() noexcept {};

template <typename U>
AlignedAllocator(const AlignedAllocator<U, alignment> &other) noexcept {}
AlignedAllocator(const AlignedAllocator<U, alignment> &other) noexcept
{
}

template <typename U>
inline bool operator==(
Expand Down

0 comments on commit 91c47a4

Please sign in to comment.