From: Uwe Hermann Date: Sat, 19 May 2018 18:36:39 +0000 (+0200) Subject: logicsegment.cpp: Suggest inlining of pack_sample()/unpack_sample(). X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=97cb532f668dd78a5100abb07d7500cbd36b6198;p=pulseview.git logicsegment.cpp: Suggest inlining of pack_sample()/unpack_sample(). These functions were not inlined by default (tested with gcc 7.3.0). They're in a hot code path, so inlining can help with performance here. --- diff --git a/pv/data/logicsegment.cpp b/pv/data/logicsegment.cpp index 3896ff21..707f797d 100644 --- a/pv/data/logicsegment.cpp +++ b/pv/data/logicsegment.cpp @@ -64,7 +64,7 @@ LogicSegment::~LogicSegment() free(l.data); } -uint64_t LogicSegment::unpack_sample(const uint8_t *ptr) const +inline uint64_t LogicSegment::unpack_sample(const uint8_t *ptr) const { #ifdef HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS return *(uint64_t*)ptr; @@ -102,7 +102,7 @@ uint64_t LogicSegment::unpack_sample(const uint8_t *ptr) const #endif } -void LogicSegment::pack_sample(uint8_t *ptr, uint64_t value) +inline void LogicSegment::pack_sample(uint8_t *ptr, uint64_t value) { #ifdef HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS *(uint64_t*)ptr = value;