aboutsummaryrefslogtreecommitdiffstats
path: root/core/fpu_ctrl.h
blob: e6dc1fb2b4d07bcb9e9feb9c5bf969c202e84a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef CORE_FPU_CTRL_H
#define CORE_FPU_CTRL_H

class FPUCtl {
#if defined(HAVE_SSE_INTRINSICS) || (defined(__GNUC__) && defined(HAVE_SSE))
    unsigned int sse_state{};
#endif
    bool in_mode{};

public:
    FPUCtl() noexcept { enter(); in_mode = true; };
    ~FPUCtl() { if(in_mode) leave(); }

    FPUCtl(const FPUCtl&) = delete;
    FPUCtl& operator=(const FPUCtl&) = delete;

    void enter() noexcept;
    void leave() noexcept;
};

#endif /* CORE_FPU_CTRL_H */