Skip to content

Commit

Permalink
Memory alignment of ControlDoublePrivate to reduce size from 464 byte…
Browse files Browse the repository at this point in the history
… to 448 byte

First fields fit in 128 byte SSE register now
  • Loading branch information
JoergAtGithub committed Jun 28, 2024
1 parent ea4fb6a commit 829ae91
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
14 changes: 7 additions & 7 deletions src/control/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ QWeakPointer<ControlDoublePrivate> s_pDefaultCO;
} // namespace

ControlDoublePrivate::ControlDoublePrivate()
: m_bPersistInConfiguration(false),
m_bIgnoreNops(true),
m_bTrack(false),
m_trackType(Stat::UNSPECIFIED),
: m_trackType(Stat::UNSPECIFIED),
m_trackFlags(Stat::COUNT | Stat::SUM | Stat::AVERAGE |
Stat::SAMPLE_VARIANCE | Stat::MIN | Stat::MAX),
m_bTrack(false),
// default CO is read only
m_confirmRequired(true),
m_bPersistInConfiguration(false),
m_bIgnoreNops(true),
m_kbdRepeatable(false) {
m_value.setValue(0.0);
}
Expand All @@ -51,13 +51,13 @@ ControlDoublePrivate::ControlDoublePrivate(
double defaultValue)
: m_key(key),
m_pCreatorCO(pCreatorCO),
m_bPersistInConfiguration(bPersist),
m_bIgnoreNops(bIgnoreNops),
m_bTrack(bTrack),
m_trackType(Stat::UNSPECIFIED),
m_trackFlags(Stat::COUNT | Stat::SUM | Stat::AVERAGE |
Stat::SAMPLE_VARIANCE | Stat::MIN | Stat::MAX),
m_bTrack(bTrack),
m_confirmRequired(false),
m_bPersistInConfiguration(bPersist),
m_bIgnoreNops(bIgnoreNops),
m_kbdRepeatable(false) {
initialize(defaultValue);
}
Expand Down
39 changes: 21 additions & 18 deletions src/control/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,29 @@ class ControlDoublePrivate : public QObject {

const ConfigKey m_key;

QSharedPointer<ControlNumericBehavior> m_pBehavior;

// User-visible, i18n name for what the control is.
QString m_name;

// User-visible, i18n description for what the control does.
QString m_description;

// The control value.
ControlValueAtomic<double> m_value;
// The default control value.
ControlValueAtomic<double> m_defaultValue;

QAtomicPointer<ControlObject> m_pCreatorCO;

QString m_trackKey;

// Whether to track value changes with the stats framework.
int m_trackType;
int m_trackFlags;
bool m_bTrack;
bool m_confirmRequired;

// Whether the control should persist in the Mixxx user configuration. The
// value is loaded from configuration when the control is created and
// written to the configuration when the control is deleted.
Expand All @@ -193,28 +214,10 @@ class ControlDoublePrivate : public QObject {
// Whether to ignore sets which would have no effect.
bool m_bIgnoreNops;

// Whether to track value changes with the stats framework.
bool m_bTrack;
QString m_trackKey;
int m_trackType;
int m_trackFlags;
bool m_confirmRequired;

// User-visible, i18n name for what the control is.
QString m_name;

// User-visible, i18n description for what the control does.
QString m_description;

// If true, this control will be issued repeatedly if the keyboard key is held.
bool m_kbdRepeatable;

// The control value.
ControlValueAtomic<double> m_value;
// The default control value.
ControlValueAtomic<double> m_defaultValue;

QSharedPointer<ControlNumericBehavior> m_pBehavior;
};

/// The constant ControlDoublePrivate version is used as dummy for default
Expand Down

0 comments on commit 829ae91

Please sign in to comment.