From ca204626a17675a912aca16835ab0d520592dd4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 1 Feb 2020 19:21:41 +0100 Subject: [PATCH] Some hot path inlining --- src/map/IMG/huffmanstream.cpp | 23 ----------------------- src/map/IMG/huffmanstream.h | 12 ++++++++++-- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/map/IMG/huffmanstream.cpp b/src/map/IMG/huffmanstream.cpp index bb4fc4fe..39c89317 100644 --- a/src/map/IMG/huffmanstream.cpp +++ b/src/map/IMG/huffmanstream.cpp @@ -23,29 +23,6 @@ HuffmanStream::HuffmanStream(const SubFile &file, SubFile::Handle &hdl, } } -bool HuffmanStream::readNext(qint32 &lonDelta, qint32 &latDelta) -{ - if (!readDelta(_lonSign, lonDelta)) - return false; - if (!readDelta(_latSign, latDelta)) - return false; - - if (!(lonDelta|latDelta)) - return false; - - return true; -} - -bool HuffmanStream::readOffset(qint32 &lonDelta, qint32 &latDelta) -{ - if (!readDelta(1, lonDelta)) - return false; - if (!readDelta(1, latDelta)) - return false; - - return true; -} - bool HuffmanStream::sign(int &val) { quint32 bit; diff --git a/src/map/IMG/huffmanstream.h b/src/map/IMG/huffmanstream.h index 38f1d490..ad44443f 100644 --- a/src/map/IMG/huffmanstream.h +++ b/src/map/IMG/huffmanstream.h @@ -9,8 +9,16 @@ public: HuffmanStream(const SubFile &file, SubFile::Handle &hdl, quint32 length, const HuffmanTable &table, bool line); - bool readNext(qint32 &lonDelta, qint32 &latDelta); - bool readOffset(qint32 &lonDelta, qint32 &latDelta); + bool readNext(qint32 &lonDelta, qint32 &latDelta) + { + if (!(readDelta(_lonSign, lonDelta) && readDelta(_latSign, latDelta))) + return false; + + return (lonDelta || latDelta); + } + + bool readOffset(qint32 &lonDelta, qint32 &latDelta) + {return (readDelta(1, lonDelta) && readDelta(1, latDelta));} bool atEnd() const {return _symbolDataSize + bitsAvailable() < _table.maxSymbolSize();}