mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Add a RAII wrapper for enabling flush-to-zero
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "utils.h"
|
||||
|
||||
#include <sched.h>
|
||||
#include <xmmintrin.h>
|
||||
#include <boost/process/environment.hpp>
|
||||
|
||||
namespace bp = boost::process;
|
||||
@@ -46,3 +47,12 @@ bool set_realtime_priority(bool sched_fifo, int priority) {
|
||||
return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER,
|
||||
¶ms) == 0;
|
||||
}
|
||||
|
||||
ScopedFlushToZero::ScopedFlushToZero() {
|
||||
old_ftz_mode = _MM_GET_FLUSH_ZERO_MODE();
|
||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
||||
}
|
||||
|
||||
ScopedFlushToZero::~ScopedFlushToZero() {
|
||||
_MM_SET_FLUSH_ZERO_MODE(old_ftz_mode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user