From 6da8ec352590299c0885d145af17634048476c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 23 Oct 2024 08:01:14 +0200 Subject: [PATCH] Micro-optimization --- src/map/IMG/jls.cpp | 2 +- src/map/matrix.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/map/IMG/jls.cpp b/src/map/IMG/jls.cpp index 23bdd047..3bd6f800 100644 --- a/src/map/IMG/jls.cpp +++ b/src/map/IMG/jls.cpp @@ -322,7 +322,7 @@ bool JLS::decode(const SubFile *file, SubFile::Handle &hdl, Matrix &img) if (!readLine(bs)) return false; - memcpy(&img.at(i, 0), _current + 1, _w * sizeof(quint16)); + memcpy(img.row(i), _current + 1, _w * sizeof(quint16)); quint16 *tmp = _last; _last = _current; diff --git a/src/map/matrix.h b/src/map/matrix.h index abd1b1ee..6b4aff42 100644 --- a/src/map/matrix.h +++ b/src/map/matrix.h @@ -21,6 +21,7 @@ public: T &at(int n) {return _m[n];} T &at(int i, int j) {return _m[_w * i + j];} T const &at(int i, int j) const {return _m.at(_w * i + j);} + T *row(int i) {return &_m[_w * i];} bool isNull() const {return (_h == 0 || _w == 0);} int size() const {return _m.size();}