Skip to content

Commit 9c476b7

Browse files
committed
Fix warnings, remove -march=native from test runs
1 parent 14c0f2a commit 9c476b7

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

.verify-helper/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[[languages.cpp.environments]]
22
CXX = "g++"
3-
CXXFLAGS = ["-std=c++23", "-Wall", "-Wextra", "-Wconversion", "-Werror", "-pedantic", "-O2", "-march=native"]
3+
CXXFLAGS = ["-std=c++23", "-Wall", "-Wextra", "-Wconversion", "-Werror", "-pedantic", "-O2"]

cp-algo/math/cvector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace cp_algo::math::fft {
3030
vpoint& at(size_t k) {return r[k / flen];}
3131
vpoint at(size_t k) const {return r[k / flen];}
3232
template<class pt = point>
33-
void set(size_t k, pt t) {
33+
void set(size_t k, pt const& t) {
3434
if constexpr(std::is_same_v<pt, point>) {
3535
real(r[k / flen])[k % flen] = real(t);
3636
imag(r[k / flen])[k % flen] = imag(t);

cp-algo/util/complex.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ namespace cp_algo {
1010
using value_type = T;
1111
T x, y;
1212
constexpr complex(): x(), y() {}
13-
constexpr complex(T x): x(x), y() {}
14-
constexpr complex(T x, T y): x(x), y(y) {}
15-
complex& operator *= (T t) {x *= t; y *= t; return *this;}
16-
complex& operator /= (T t) {x /= t; y /= t; return *this;}
17-
complex operator * (T t) const {return complex(*this) *= t;}
18-
complex operator / (T t) const {return complex(*this) /= t;}
19-
complex& operator += (complex t) {x += t.x; y += t.y; return *this;}
20-
complex& operator -= (complex t) {x -= t.x; y -= t.y; return *this;}
21-
complex operator * (complex t) const {return {x * t.x - y * t.y, x * t.y + y * t.x};}
22-
complex operator / (complex t) const {return *this * t.conj() / t.norm();}
23-
complex operator + (complex t) const {return complex(*this) += t;}
24-
complex operator - (complex t) const {return complex(*this) -= t;}
25-
complex& operator *= (complex t) {return *this = *this * t;}
26-
complex& operator /= (complex t) {return *this = *this / t;}
13+
constexpr complex(T const& x): x(x), y() {}
14+
constexpr complex(T const& x, T const& y): x(x), y(y) {}
15+
complex& operator *= (T const& t) {x *= t; y *= t; return *this;}
16+
complex& operator /= (T const& t) {x /= t; y /= t; return *this;}
17+
complex operator * (T const& t) const {return complex(*this) *= t;}
18+
complex operator / (T const& t) const {return complex(*this) /= t;}
19+
complex& operator += (complex const& t) {x += t.x; y += t.y; return *this;}
20+
complex& operator -= (complex const& t) {x -= t.x; y -= t.y; return *this;}
21+
complex operator * (complex const& t) const {return {x * t.x - y * t.y, x * t.y + y * t.x};}
22+
complex operator / (complex const& t) const {return *this * t.conj() / t.norm();}
23+
complex operator + (complex const& t) const {return complex(*this) += t;}
24+
complex operator - (complex const& t) const {return complex(*this) -= t;}
25+
complex& operator *= (complex const& t) {return *this = *this * t;}
26+
complex& operator /= (complex const& t) {return *this = *this / t;}
2727
complex operator - () const {return {-x, -y};}
2828
complex conj() const {return {x, -y};}
2929
T norm() const {return x * x + y * y;}
@@ -35,9 +35,9 @@ namespace cp_algo {
3535
static constexpr complex polar(T r, T theta) {return {T(r * cos(theta)), T(r * sin(theta))};}
3636
auto operator <=> (complex const& t) const = default;
3737
};
38-
template<typename T> complex<T> conj(complex<T> x) {return x.conj();}
39-
template<typename T> T norm(complex<T> x) {return x.norm();}
40-
template<typename T> T abs(complex<T> x) {return x.abs();}
38+
template<typename T> complex<T> conj(complex<T> const& x) {return x.conj();}
39+
template<typename T> T norm(complex<T> const& x) {return x.norm();}
40+
template<typename T> T abs(complex<T> const& x) {return x.abs();}
4141
template<typename T> T& real(complex<T> &x) {return x.real();}
4242
template<typename T> T& imag(complex<T> &x) {return x.imag();}
4343
template<typename T> [[gnu::target("avx2")]] T const real(complex<T> const& x) {return x.real();}
@@ -47,7 +47,7 @@ namespace cp_algo {
4747
return complex<T>::polar(r, theta);
4848
}
4949
template<typename T>
50-
std::ostream& operator << (std::ostream &out, complex<T> x) {
50+
std::ostream& operator << (std::ostream &out, complex<T> const& x) {
5151
return out << x.real() << ' ' << x.imag();
5252
}
5353
}

0 commit comments

Comments
 (0)