]> sigrok.org Git - pulseview.git/commitdiff
logicsegment.cpp: Suggest inlining of pack_sample()/unpack_sample().
authorUwe Hermann <redacted>
Sat, 19 May 2018 18:36:39 +0000 (20:36 +0200)
committerUwe Hermann <redacted>
Sat, 19 May 2018 18:51:13 +0000 (20:51 +0200)
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.

pv/data/logicsegment.cpp

index 3896ff2151efc09989d34211b78399f017473c88..707f797d294accad64b5ee12f1ecd1551049344d 100644 (file)
@@ -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;