From fde83528970007e3bf6ad3b8364ba04a140d0f96 Mon Sep 17 00:00:00 2001 From: nindanaoto Date: Fri, 12 Jul 2024 17:27:04 +0000 Subject: [PATCH] remove stack issue in CI and rm some warnings --- include/raintt.hpp | 16 ++++++++-------- include/trgsw.hpp | 2 +- test/gatebootstrapping.cpp | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/raintt.hpp b/include/raintt.hpp index 2cea112..506b164 100644 --- a/include/raintt.hpp +++ b/include/raintt.hpp @@ -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; @@ -116,7 +116,7 @@ constexpr Word PowREDC(const Word a, const uint e) } template -constexpr Word ext_gcd(SWord &x, SWord &y) +constexpr Word Bit_gcd(SWord &x, SWord &y) { if constexpr (b == 0) { x = 1; @@ -124,7 +124,7 @@ constexpr Word ext_gcd(SWord &x, SWord &y) return a; } else { - Word d = ext_gcd(y, x); + Word d = Bit_gcd(y, x); y -= a / b * x; return d; } @@ -134,7 +134,7 @@ template constexpr Word inv_mod() { SWord x, y; - const Word g = ext_gcd(x, y); + const Word g = Bit_gcd(x, y); if (g != 1) { throw "Inverse doesn't exist"; } @@ -168,7 +168,7 @@ template std::unique_ptr, 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(); std::unique_ptr, 2>> twist = diff --git a/include/trgsw.hpp b/include/trgsw.hpp index e2d48ef..fc5f40e 100644 --- a/include/trgsw.hpp +++ b/include/trgsw.hpp @@ -70,7 +70,7 @@ inline void Decomposition(DecomposedPolynomial

&decpoly, const Polynomial

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::digits - (l + 1) * P::Bgbit)) & mask) - diff --git a/test/gatebootstrapping.cpp b/test/gatebootstrapping.cpp index 53f9b02..a3a3337 100644 --- a/test/gatebootstrapping.cpp +++ b/test/gatebootstrapping.cpp @@ -22,7 +22,7 @@ int main() TFHEpp::EvalKey ek; ek.emplacebkfft(sk); ek.emplaceiksk(sk); - std::array, num_test> tlwe, bootedtlwe; + std::vector> tlwe(num_test), bootedtlwe(num_test); std::array p; for (int i = 0; i < num_test; i++) p[i] = binary(engine) > 0; for (int i = 0; i < num_test; i++)