2
0
mirror of https://github.com/boostorg/atomic.git synced 2026-02-01 08:12:07 +00:00

Added support for atomic floating point operations.

The support includes:

- The standard fetch_add/fetch_sub operations.
- Extra operations: (fetch_/opaque_)negate, (opaque_)add/sub.
- Extra capability macros: BOOST_ATOMIC_FLOAT/DOUBLE/LONG_DOUBLE_LOCK_FREE.

The atomic operations are currently implemented on top of the integer-based
backends and thus are mostly CAS-based. The CAS operations perform binary
comparisons, and as such have different behavior wrt. special FP values like
NaN and signed zero than normal C++.

The support for floating point types is optional and can be disabled by
defining BOOST_ATOMIC_NO_FLOATING_POINT. This can be useful if on a certain
platform parameters of the floating point types cannot be deduced from the
compiler-defined or system macros (in which case the compilation fails).

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0020r6.html
This commit is contained in:
Andrey Semashev
2018-02-13 03:09:32 +03:00
parent e751e235bc
commit edef50f042
28 changed files with 1612 additions and 36 deletions

View File

@@ -45,6 +45,13 @@ int main(int, char *[])
test_constexpr_ctor<long>();
test_constexpr_ctor<int*>();
test_floating_point_api<float>();
test_floating_point_api<double>();
test_floating_point_api<long double>();
#if defined(BOOST_HAS_FLOAT128)
test_floating_point_api<boost::float128_type>();
#endif
test_pointer_api<int>();
test_enum_api();