Skip to content

Commit

Permalink
Run pre-commit on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
fboemer committed Apr 2, 2021
1 parent f4a4def commit 3f5f8a9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmake/CheckCXXIntrinsicsHeader.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ if(SEAL_USE_INTRIN)
if(SEAL_ARM64)
set(SEAL_INTRIN_HEADER "arm_neon.h")
elseif(EMSCRIPTEN)
set(SEAL_INTRIN_HEADER "wasm_simd128.h")
set(SEAL_INTRIN_HEADER "wasm_simd128.h")
else()
set(SEAL_INTRIN_HEADER "x86intrin.h")
endif()
endif()

check_include_file_cxx(${SEAL_INTRIN_HEADER} SEAL_INTRIN_HEADER_FOUND)
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/SEALMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ macro(seal_set_secure_compile_options target scope)
target_link_options(${target} ${scope} /guard:cf)
target_link_options(${target} ${scope} /DYNAMICBASE)
endif()
endmacro()
endmacro()
2 changes: 1 addition & 1 deletion native/src/seal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ install(
)

add_subdirectory(util)
set(SEAL_SOURCE_FILES ${SEAL_SOURCE_FILES} PARENT_SCOPE)
set(SEAL_SOURCE_FILES ${SEAL_SOURCE_FILES} PARENT_SCOPE)
10 changes: 5 additions & 5 deletions native/src/seal/evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,8 @@ namespace seal
RNSIter temp_iter(temp.get(), coeff_count);
SEAL_ITERATE(iter(temp_iter, plain_upper_half_increment), coeff_modulus_size, [&](auto I) {
SEAL_ITERATE(iter(get<0>(I), plain.data()), plain_coeff_count, [&](auto J) {
get<0>(J) = SEAL_COND_SELECT(get<1>(J) >= plain_upper_half_threshold, get<1>(J) + get<1>(I), get<1>(J));
get<0>(J) =
SEAL_COND_SELECT(get<1>(J) >= plain_upper_half_threshold, get<1>(J) + get<1>(I), get<1>(J));
});
});
}
Expand Down Expand Up @@ -1748,7 +1749,8 @@ namespace seal

SEAL_ITERATE(helper_iter, coeff_modulus_size, [&](auto I) {
SEAL_ITERATE(iter(*plain_iter, get<0>(I)), plain_coeff_count, [&](auto J) {
get<1>(J) = SEAL_COND_SELECT(get<0>(J) >= plain_upper_half_threshold, get<0>(J) + get<1>(I), get<0>(J));
get<1>(J) =
SEAL_COND_SELECT(get<0>(J) >= plain_upper_half_threshold, get<0>(J) + get<1>(I), get<0>(J));
});
});
}
Expand Down Expand Up @@ -2240,9 +2242,7 @@ namespace seal
ntt_negacyclic_harvey_lazy(t_ntt, get<2>(J));
#if SEAL_USER_MOD_BIT_COUNT_MAX > 60
// Reduce from [0, 4qi) to [0, 2qi)
SEAL_ITERATE(t_ntt, coeff_count, [&](auto &K) {
K -= SEAL_COND_SELECT(K >= qi_lazy, qi_lazy, 0);
});
SEAL_ITERATE(t_ntt, coeff_count, [&](auto &K) { K -= SEAL_COND_SELECT(K >= qi_lazy, qi_lazy, 0); });
#else
// Since SEAL uses at most 60bit moduli, 8*qi < 2^63.
qi_lazy = qi << 2;
Expand Down
8 changes: 4 additions & 4 deletions native/src/seal/util/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ namespace seal
// Still need to consider integer-float conversions and all
// unsigned to signed conversions
}

SEAL_IF_CONSTEXPR(std::is_integral<T>::value && std::is_integral<S>::value)
{
// Both integer types
Expand All @@ -292,7 +292,7 @@ namespace seal
// Non-negative number; compare as std::uint64_t
// Cannot use unsigned_leq with C++14 for lack of `if constexpr'
result = static_cast<std::uint64_t>(value) <=
static_cast<std::uint64_t>((std::numeric_limits<T>::max)());
static_cast<std::uint64_t>((std::numeric_limits<T>::max)());
}
else
{
Expand All @@ -305,13 +305,13 @@ namespace seal
{
// Converting to floating-point
result = (static_cast<double>(value) <= static_cast<double>((std::numeric_limits<T>::max)())) &&
(static_cast<double>(value) >= -static_cast<double>((std::numeric_limits<T>::max)()));
(static_cast<double>(value) >= -static_cast<double>((std::numeric_limits<T>::max)()));
}
else
{
// Converting from floating-point
result = (static_cast<double>(value) <= static_cast<double>((std::numeric_limits<T>::max)())) &&
(static_cast<double>(value) >= static_cast<double>((std::numeric_limits<T>::min)()));
(static_cast<double>(value) >= static_cast<double>((std::numeric_limits<T>::min)()));
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion native/src/seal/util/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,4 @@ namespace seal

// Conditionally select the former if true and the latter if false
// This is a temporary solution that generates constant-time code with all compilers on all platforms.
#define SEAL_COND_SELECT(cond, if_true, if_false) (cond ? if_true : if_false)
#define SEAL_COND_SELECT(cond, if_true, if_false) (cond ? if_true : if_false)

0 comments on commit 3f5f8a9

Please sign in to comment.