diff base/Clipboard.h @ 1610:7db29268cf4c single-point

Bitfield + reorder for packing
author Chris Cannam
date Tue, 05 Mar 2019 14:18:37 +0000
parents ad5f892c0c4d
children b2f32c554199
line wrap: on
line diff
--- a/base/Clipboard.h	Tue Mar 05 13:21:55 2019 +0000
+++ b/base/Clipboard.h	Tue Mar 05 14:18:37 2019 +0000
@@ -31,8 +31,9 @@
         Point(sv_frame_t frame, float value, QString label);
         Point(sv_frame_t frame, float value, sv_frame_t duration, QString label);
         Point(sv_frame_t frame, float value, sv_frame_t duration, float level, QString label);
-        Point(const Point &point);
-        Point &operator=(const Point &point);
+
+        Point(const Point &point) =default;
+        Point &operator=(const Point &point) =default;
 
         bool haveFrame() const;
         sv_frame_t getFrame() const;
@@ -61,18 +62,20 @@
         void setReferenceFrame(sv_frame_t);
 
     private:
-        bool m_haveFrame;
+        // Order of fields here is chosen to minimise overall size of struct.
+        // If you change something, check what difference it makes to packing.
+        bool m_haveValue : 1;
+        bool m_haveLevel : 1;
+        bool m_haveFrame : 1;
+        bool m_haveDuration : 1;
+        bool m_haveReferenceFrame : 1;
+        bool m_haveLabel : 1;
+        float m_value;
+        float m_level;
         sv_frame_t m_frame;
-        bool m_haveValue;
-        float m_value;
-        bool m_haveDuration;
         sv_frame_t m_duration;
-        bool m_haveLabel;
+        sv_frame_t m_referenceFrame;
         QString m_label;
-        bool m_haveLevel;
-        float m_level;
-        bool m_haveReferenceFrame;
-        sv_frame_t m_referenceFrame;
     };
 
     Clipboard();