diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2018-06-22 12:54:47 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-06-26 23:01:53 +0200 | 
| commit | f50ac3549d6a7f1199fa012e4b03f581bc8d305b (patch) | |
| tree | 50ff044f1c618119c88544709808f533ed02225e /logic | |
| parent | d61eb905ae3fa161d50821d01ee47915713e89c2 (diff) | |
core, modules: modernize syntax only
Use more C++17 features where this helps any.
Diffstat (limited to 'logic')
| -rw-r--r-- | logic/pipeline.cpp | 18 | ||||
| -rw-r--r-- | logic/pipeline.hpp | 4 | 
2 files changed, 9 insertions, 13 deletions
| diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index c36d1781..6c00acb0 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -638,29 +638,25 @@ void pipeline::set_zero(bool value) { set(f_zero, value); }  void pipeline::toggle_zero() { negate(f_zero); }  void pipeline::toggle_enabled() { negate(f_enabled_p); } -void bits::set(flags flag_, bool val_) +void bits::set(flags flag, bool val)  { -    const unsigned flag = unsigned(flag_); -    const unsigned val = unsigned(val_); +    const unsigned flag_ = unsigned(flag); +    const unsigned val_ = unsigned(val);      unsigned b_ = 0;      for (;;) -    { -        if (b.compare_exchange_strong(b_, unsigned((b_ & ~flag) | (flag * val)))) +        if (b.compare_exchange_weak(b_, unsigned((b_ & ~flag_) | (flag_ * val_))))              break; -    }  } -void bits::negate(flags flag_) +void bits::negate(flags flag)  { -    const unsigned flag = unsigned(flag_); +    const unsigned flag_= flag;      unsigned b_ = 0;      for (;;) -    { -        if (b.compare_exchange_strong(b_, b_ ^ flag)) +        if (b.compare_exchange_weak(b_, b_ ^ flag_))              break; -    }  }  bool bits::get(flags flag) diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 606a7bf6..5db2a753 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -74,8 +74,8 @@ struct OTR_LOGIC_EXPORT bits      std::atomic<unsigned> b; -    void set(flags flag_, bool val); -    void negate(flags flag_); +    void set(flags flag, bool val); +    void negate(flags flag);      bool get(flags flag);      bits();  }; | 
