atomic-fxbox-/fetch! clarification Shiro Kawai (14 Nov 2024 22:04 UTC)
Re: atomic-fxbox-/fetch! clarification Marc Nieper-Wißkirchen (15 Nov 2024 06:55 UTC)
Re: atomic-fxbox-/fetch! clarification Shiro Kawai (15 Nov 2024 07:39 UTC)
Re: atomic-fxbox-/fetch! clarification Marc Nieper-Wißkirchen (15 Nov 2024 07:49 UTC)
Re: atomic-fxbox-/fetch! clarification Shiro Kawai (16 Nov 2024 05:08 UTC)
Re: atomic-fxbox-/fetch! clarification Arthur A. Gleckler (16 Nov 2024 07:29 UTC)

Re: atomic-fxbox-/fetch! clarification Marc Nieper-Wißkirchen 15 Nov 2024 06:54 UTC

Dear Shiro,

Am Do., 14. Nov. 2024 um 23:04 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:
>
> The srfi text says the content is set to "the difference of the previous content and fx".   Does it mean (- previous-content fx), (- fx previous-content), or even (abs (- fx previous-content))?
> Reference implementation is (- fx previous-content) . When I read the srfi I took it as (- previous-content fx) so it was a bit of a surprise.  (Maybe I'm conditioned to old CPU's SUB instructions).

You were right when you read it as "(- previous-content fx)". The
sample implementation is wrong.

The SRFI was modelled after the C's <stdatomic.h> (so that it can be
efficiently implemented on architectures that can efficiently
implement the C interface).  The C version of the atomic subtraction
is atomic_fetch_sub.

Thanks,

Marc

>
> The wording can be clarified, e.g. "the subtraction of previous-content from fx"?
>
> --shiro
>
>