Skip to content

Commit 0f15c26

Browse files
committed
Fix linter warnings
1 parent 9220fd1 commit 0f15c26

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

src/apps/perf/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int run(const int argc, const char **argv)
7878

7979
const f64 n = casts::to<f64>(count);
8080
const f64 mean = casts::to<f64>(total) / n;
81-
const f64 stddev = std::sqrt(casts::to<f64>(total_of_squares) / n - mean * mean);
81+
const f64 stddev = std::sqrt((casts::to<f64>(total_of_squares) / n) - (mean * mean));
8282

8383
spdlog::info("Ran {} times", count);
8484
spdlog::info("Total: {}μs", total);

src/common/error.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ template <auto T>
2121
class Error : public std::runtime_error {
2222
public:
2323
template <class... Args>
24-
Error(Args... args) : std::runtime_error {msg(args...)}
24+
Error(Args... args) : std::runtime_error {msg(std::move(args)...)}
2525
{
2626
/*
2727
* GCC doesn't see this block as empty, so adding a semicolon to the end to force

src/contacts/detection/algorithms/gaussian.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ void assemble_system(Matrix6<T> &m,
7777
const Point &bmax = b.max();
7878

7979
for (Eigen::Index iy = bmin.y(); iy <= bmax.y(); iy++) {
80-
const T y = casts::to<T>(iy) * scale.y() - 1;
80+
const T y = (casts::to<T>(iy) * scale.y()) - 1;
8181

8282
for (Eigen::Index ix = bmin.x(); ix <= bmax.x(); ix++) {
83-
const T x = casts::to<T>(ix) * scale.x() - 1;
83+
const T x = (casts::to<T>(ix) * scale.x()) - 1;
8484

8585
const T d =
8686
w(iy - bmin.y(), ix - bmin.x()) * gsl::narrow_cast<T>(data(iy, ix));
@@ -154,7 +154,7 @@ bool extract_params(const Vector6<T> &chi, T &scale, Vector2<T> &mean, Matrix2<T
154154
mean.y() = (prec(0, 0) * chi[4] - prec(0, 1) * chi[3]) / d;
155155

156156
const T vtmv = mean.transpose() * prec * mean;
157-
scale = std::exp(chi[5] + vtmv / casts::to<T>(2));
157+
scale = std::exp(chi[5] + (vtmv / casts::to<T>(2)));
158158

159159
return true;
160160
}
@@ -184,10 +184,10 @@ void update_weight_maps(std::vector<Parameters<typename DenseBase<Derived>::Scal
184184
const Point bmax = p.bounds.max();
185185

186186
for (Eigen::Index iy = bmin.y(); iy <= bmax.y(); iy++) {
187-
const T y = casts::to<T>(iy) * scale.y() - 1;
187+
const T y = (casts::to<T>(iy) * scale.y()) - 1;
188188

189189
for (Eigen::Index ix = bmin.x(); ix <= bmax.x(); ix++) {
190-
const T x = casts::to<T>(ix) * scale.x() - 1;
190+
const T x = (casts::to<T>(ix) * scale.x()) - 1;
191191

192192
const T v = p.scale * gaussian_like({x, y}, p.mean, p.prec);
193193
p.weights(iy - bmin.y(), ix - bmin.x()) = v;
@@ -294,20 +294,20 @@ bool ge_solve(Matrix6<T> a, Vector6<T> b, Vector6<T> &x)
294294
x[5] = b[5];
295295
x[5] /= a(5, 5);
296296

297-
x[4] = b[4] - a(5, 4) * x[5];
297+
x[4] = b[4] - (a(5, 4) * x[5]);
298298
x[4] /= a(4, 4);
299299

300-
x[3] = b[3] - a(5, 3) * x[5] - a(4, 3) * x[4];
300+
x[3] = b[3] - (a(5, 3) * x[5]) - (a(4, 3) * x[4]);
301301
x[3] /= a(3, 3);
302302

303-
x[2] = b[2] - a(5, 2) * x[5] - a(4, 2) * x[4] - a(3, 2) * x[3];
303+
x[2] = b[2] - (a(5, 2) * x[5]) - (a(4, 2) * x[4]) - (a(3, 2) * x[3]);
304304
x[2] /= a(2, 2);
305305

306-
x[1] = b[1] - a(5, 1) * x[5] - a(4, 1) * x[4] - a(3, 1) * x[3] - a(2, 1) * x[2];
306+
x[1] = b[1] - (a(5, 1) * x[5]) - (a(4, 1) * x[4]) - (a(3, 1) * x[3]) - (a(2, 1) * x[2]);
307307
x[1] /= a(1, 1);
308308

309-
x[0] = b[0] - a(5, 0) * x[5] - a(4, 0) * x[4] - a(3, 0) * x[3] - a(2, 0) * x[2] -
310-
a(1, 0) * x[1];
309+
x[0] = b[0] - (a(5, 0) * x[5]) - (a(4, 0) * x[4]) - (a(3, 0) * x[3]) - (a(2, 0) * x[2]) -
310+
(a(1, 0) * x[1]);
311311
x[0] /= a(0, 0);
312312

313313
return true;

src/contacts/detection/algorithms/kernels.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Matrix<T, Rows, Cols> gaussian(const T sigma)
3131
const Eigen::Index rows = kernel.rows();
3232

3333
for (Eigen::Index y = 0; y < rows; y++) {
34-
const T vy = casts::to<T>(y) - casts::to<T>(rows - 1) / casts::to<T>(2);
34+
const T vy = casts::to<T>(y) - (casts::to<T>(rows - 1) / casts::to<T>(2));
3535

3636
for (Eigen::Index x = 0; x < cols; x++) {
37-
const T vx = casts::to<T>(x) - casts::to<T>(cols - 1) / casts::to<T>(2);
37+
const T vx = casts::to<T>(x) - (casts::to<T>(cols - 1) / casts::to<T>(2));
3838

3939
const T norm = (Vector2<T> {vy, vx} / sigma).squaredNorm();
4040
const T val = std::exp(gsl::narrow_cast<T>(-0.5) * norm);

src/contacts/detection/algorithms/optimized/convolution.3x3-extend.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ inline void run_3x3(const DenseBase<DerivedData> &in,
4040
};
4141

4242
const auto d = [&](Eigen::Index i, isize dx, isize dy) constexpr -> T {
43-
const isize sdx = casts::to_signed(i) + dy * casts::to_signed(cols) + dx;
43+
const isize sdx = casts::to_signed(i) + (dy * casts::to_signed(cols)) + dx;
4444
const Eigen::Index index = casts::to_eigen(sdx);
4545

4646
if constexpr (common::buildopts::ForceAccessChecks) {

src/contacts/detection/algorithms/optimized/convolution.5x5-extend.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void run_5x5(const DenseBase<DerivedData> &in,
4040
};
4141

4242
const auto d = [&](Eigen::Index i, isize dx, isize dy) constexpr -> T {
43-
const isize sdx = casts::to_signed(i) + dy * casts::to_signed(cols) + dx;
43+
const isize sdx = casts::to_signed(i) + (dy * casts::to_signed(cols)) + dx;
4444
const Eigen::Index index = casts::to_eigen(sdx);
4545

4646
if constexpr (common::buildopts::ForceAccessChecks) {

src/contacts/finder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Finder {
3737
validation::Validator<T> m_validator;
3838

3939
public:
40-
Finder(Config<T> config)
40+
Finder(const Config<T> &config)
4141
: m_detector {config.detection},
4242
m_stabilizer {config.stability},
4343
m_validator {config.validation} {};

src/core/generic/dft.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class DftStylus {
174174
xt *= m_config.width / m_config.dft_tilt_distance;
175175
yt *= m_config.height / m_config.dft_tilt_distance;
176176

177-
const f64 azm = std::fmod(std::atan2(-yt, xt) + 2 * M_PI, 2 * M_PI);
177+
const f64 azm = std::fmod(std::atan2(-yt, xt) + (2 * M_PI), 2 * M_PI);
178178
const f64 alt = std::asin(std::min(1.0, std::hypot(xt, yt)));
179179

180180
m_stylus.azimuth = azm;
@@ -214,7 +214,7 @@ class DftStylus {
214214
dft.y[0].imag[ipts::protocol::dft::NUM_COMPONENTS / 2];
215215

216216
// same phase as position signal = eraser, opposite phase = button
217-
const i32 val = m_real * real + m_imag * imag;
217+
const i32 val = (m_real * real) + (m_imag * imag);
218218

219219
button = val < 0;
220220
rubber = val > 0;
@@ -340,9 +340,9 @@ class DftStylus {
340340
const f64 cos = row.imag.at(maxi) / amp;
341341

342342
std::array<f64, 3> x = {
343-
sin * row.real.at(maxi - 1) + cos * row.imag.at(maxi - 1),
343+
(sin * row.real.at(maxi - 1)) + (cos * row.imag.at(maxi - 1)),
344344
amp,
345-
sin * row.real.at(maxi + 1) + cos * row.imag.at(maxi + 1),
345+
(sin * row.real.at(maxi + 1)) + (cos * row.imag.at(maxi + 1)),
346346
};
347347

348348
// convert the amplitudes into something we can fit a parabola to
@@ -414,11 +414,11 @@ class DftStylus {
414414

415415
// interpolate using Eric Jacobsen's modified quadratic estimator
416416
const i32 ra = real[0] - real[2];
417-
const i32 rb = 2 * real[1] - real[0] - real[2];
417+
const i32 rb = (2 * real[1]) - real[0] - real[2];
418418
const i32 ia = imag[0] - imag[2];
419-
const i32 ib = 2 * imag[1] - imag[0] - imag[2];
419+
const i32 ib = (2 * imag[1]) - imag[0] - imag[2];
420420

421-
const f64 d = (ra * rb + ia * ib) / casts::to<f64>(rb * rb + ib * ib);
421+
const f64 d = (ra * rb + ia * ib) / casts::to<f64>((rb * rb) + (ib * ib));
422422

423423
return (maxi + std::clamp(d, mind, maxd)) / (rows - 1);
424424
}

src/core/linux/runner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Runner {
7070
info.meta = m_ipts.metadata();
7171

7272
const ConfigLoader loader {info};
73-
m_application.emplace(loader.config(), info, args...);
73+
m_application.emplace(loader.config(), info, std::move(args)...);
7474

7575
m_buffer.resize(m_ipts.buffer_size());
7676

0 commit comments

Comments
 (0)