mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Properly handle move semantics in the scoped FTZ
This commit is contained in:
+15
-1
@@ -54,5 +54,19 @@ ScopedFlushToZero::ScopedFlushToZero() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScopedFlushToZero::~ScopedFlushToZero() {
|
ScopedFlushToZero::~ScopedFlushToZero() {
|
||||||
_MM_SET_FLUSH_ZERO_MODE(old_ftz_mode);
|
if (old_ftz_mode) {
|
||||||
|
_MM_SET_FLUSH_ZERO_MODE(*old_ftz_mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedFlushToZero::ScopedFlushToZero(ScopedFlushToZero&& o)
|
||||||
|
: old_ftz_mode(std::move(o.old_ftz_mode)) {
|
||||||
|
o.old_ftz_mode.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedFlushToZero& ScopedFlushToZero::operator=(ScopedFlushToZero&& o) {
|
||||||
|
old_ftz_mode = std::move(o.old_ftz_mode);
|
||||||
|
o.old_ftz_mode.reset();
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -97,6 +97,9 @@ class ScopedFlushToZero {
|
|||||||
ScopedFlushToZero(const ScopedFlushToZero&) = delete;
|
ScopedFlushToZero(const ScopedFlushToZero&) = delete;
|
||||||
ScopedFlushToZero& operator=(const ScopedFlushToZero&) = delete;
|
ScopedFlushToZero& operator=(const ScopedFlushToZero&) = delete;
|
||||||
|
|
||||||
|
ScopedFlushToZero(ScopedFlushToZero&&);
|
||||||
|
ScopedFlushToZero& operator=(ScopedFlushToZero&&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The previous FTZ mode. When we use this on the Wine side, this should
|
* The previous FTZ mode. When we use this on the Wine side, this should
|
||||||
@@ -104,5 +107,5 @@ class ScopedFlushToZero {
|
|||||||
* don't accidentally end up disabling FTZ somewhere where it should be
|
* don't accidentally end up disabling FTZ somewhere where it should be
|
||||||
* enabled.
|
* enabled.
|
||||||
*/
|
*/
|
||||||
unsigned int old_ftz_mode;
|
std::optional<unsigned int> old_ftz_mode;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user