Skip to content

Commit 364ea04

Browse files
authored
Merge pull request #19 from atcoder/patch/issue3
fix #3: fix internal_math for msvc
2 parents 1084ef6 + 91672f4 commit 364ea04

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

atcoder/internal_math.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ constexpr bool is_prime_constexpr(int n) {
8383
if (n % 2 == 0) return false;
8484
long long d = n - 1;
8585
while (d % 2 == 0) d /= 2;
86-
for (long long a : {2, 7, 61}) {
86+
constexpr long long bases[3] = {2, 7, 61};
87+
for (long long a : bases) {
8788
long long t = d;
8889
long long y = pow_mod_constexpr(a, t, n);
8990
while (t != n - 1 && y != 1 && y != n - 1) {

test/unittest/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if(NOT MSVC)
1515
add_link_options(-fsanitize=undefined,address)
1616
else()
1717
message("Use MSVC")
18-
add_compile_options(/W4)
18+
add_compile_options(/W4 /permissive- /sdl)
1919
endif()
2020

2121
add_subdirectory(googletest)

test/unittest/convolution_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ TEST(ConvolutionTest, ConvLLBound) {
335335
static constexpr unsigned long long M1M3 = MOD1 * MOD3;
336336
static constexpr unsigned long long M1M2 = MOD1 * MOD2;
337337
for (int i = -1000; i <= 1000; i++) {
338-
std::vector<ll> a = {(long long)(-M1M2 - M1M3 - M2M3 + i)};
338+
std::vector<ll> a = {(long long)(0ULL - M1M2 - M1M3 - M2M3 + i)};
339339
std::vector<ll> b = {1};
340340

341341
ASSERT_EQ(a, convolution_ll(a, b));

0 commit comments

Comments
 (0)