Skip to content

Commit

Permalink
remove stack issue in CI and rm some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nindanaoto committed Jul 12, 2024
1 parent 041dde8 commit fde8352
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions include/raintt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ constexpr uint wordbits = 27;
constexpr uint wordbits = 31;
#endif
//_ExtInt is equivalent to _BitInt in C23
using Word = unsigned _ExtInt(wordbits);
using SWord = signed _ExtInt(wordbits);
using DoubleWord = unsigned _ExtInt(2 * wordbits);
using DoubleSWord = signed _ExtInt(2 * wordbits);
using Word = unsigned _BitInt(wordbits);
using SWord = signed _BitInt(wordbits);
using DoubleWord = unsigned _BitInt(2 * wordbits);
using DoubleSWord = signed _BitInt(2 * wordbits);
#else
constexpr uint wordbits = 32;
using Word = uint32_t;
Expand Down Expand Up @@ -116,15 +116,15 @@ constexpr Word PowREDC(const Word a, const uint e)
}

template <Word a, Word b>
constexpr Word ext_gcd(SWord &x, SWord &y)
constexpr Word Bit_gcd(SWord &x, SWord &y)
{
if constexpr (b == 0) {
x = 1;
y = 0;
return a;
}
else {
Word d = ext_gcd<b, a % b>(y, x);
Word d = Bit_gcd<b, a % b>(y, x);
y -= a / b * x;
return d;
}
Expand All @@ -134,7 +134,7 @@ template <Word a>
constexpr Word inv_mod()
{
SWord x, y;
const Word g = ext_gcd<a, P>(x, y);
const Word g = Bit_gcd<a, P>(x, y);
if (g != 1) {
throw "Inverse doesn't exist";
}
Expand Down Expand Up @@ -168,7 +168,7 @@ template <uint Nbit, uint radixbit>
std::unique_ptr<std::array<std::array<SWord, 1U << Nbit>, 2>> TwistGen()
{
constexpr uint N = 1U << Nbit;
constexpr uint8_t remainder = ((Nbit - 1) % radixbit) + 1;
// constexpr uint8_t remainder = ((Nbit - 1) % radixbit) + 1;
const Word invN = inv_mod<N>();

std::unique_ptr<std::array<std::array<SWord, 1U << Nbit>, 2>> twist =
Expand Down
2 changes: 1 addition & 1 deletion include/trgsw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ inline void Decomposition(DecomposedPolynomial<P> &decpoly, const Polynomial<P>

for (int i = 0; i < P::n; i++) {
for (int l = 0; l < P::l; l++)
decpoly[l][i] = ((poly[i] + offset + roundoffset >>
decpoly[l][i] = (((poly[i] + offset + roundoffset) >>
(std::numeric_limits<typename P::T>::digits -
(l + 1) * P::Bgbit)) &
mask) -
Expand Down
2 changes: 1 addition & 1 deletion test/gatebootstrapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ int main()
TFHEpp::EvalKey ek;
ek.emplacebkfft<bkP>(sk);
ek.emplaceiksk<iksP>(sk);
std::array<TFHEpp::TLWE<typename iksP::domainP>, num_test> tlwe, bootedtlwe;
std::vector<TFHEpp::TLWE<typename iksP::domainP>> tlwe(num_test), bootedtlwe(num_test);
std::array<bool, num_test> p;
for (int i = 0; i < num_test; i++) p[i] = binary(engine) > 0;
for (int i = 0; i < num_test; i++)
Expand Down

0 comments on commit fde8352

Please sign in to comment.