Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
fnrizzi committed Mar 9, 2023
1 parent ecebe73 commit 5e12338
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions docs/source/API/core/atomics/atomic_exchange.rst
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
``atomic_exchange``
===================

.. role::cpp(code)
:language: cpp
.. role:: cppkokkos(code)
:language: cppkokkos

Header File: ``Kokkos_Core.hpp``
Header File: <Kokkos_Core.hpp>

Usage:
Usage
-----

.. code-block:: cpp
old_val = atomic_exchange(ptr_to_value,new_value);
old_val = atomic_exchange(ptr_to_value, new_value);
Atomically sets the value at the address given by ``ptr_to_value`` to ``new_value`` and returns the previously stored value at the address.

Synopsis
--------

.. code-block:: cpp
template<class T>
T atomic_exchange(T* const ptr_to_value, const T new_value);
Description
-----------

- .. code-block:: cpp
.. cppkokkos:function:: template<class T> T atomic_exchange(T* const ptr_to_value, const T new_value);
template<class T>
T atomic_exchange(T* const ptr_to_value, const T new_value);
Atomically executes ``old_value = *ptr_to_value; *ptr_to_value = new_value; return old_value;``,
where ``old_value`` is the value at address ``ptr_to_value`` before doing the exchange.

Atomically executes ``old_value = *ptr_to_value; *ptr_to_value = new_value; return old_value;``.
:param ptr_to_value: address of the value to be updated

- ``ptr_to_value``: address of the to be updated value.
- ``new_value``: new value.
- ``old_value``: value at address ``ptr_to_value`` before doing the exchange.
:param new_value: new value

0 comments on commit 5e12338

Please sign in to comment.