Commit Graph

6 Commits

Author SHA1 Message Date
eNV25
976602f5dc all: go fmt ./... with go1.19 (#110) 2022-08-05 09:14:45 -07:00
Sung Yoon Whang
6a01446a63 Fix lint error on float64_ext.go (#97) 2021-06-17 15:09:53 -07:00
Prashant Varanasi
d8a8972198 Improve argument/return names for better docs (#96)
This change is a renaming with no functional changes.

It includes the following renames:
 * `val` for arguments that replace the atomic value (e.g., `Store`).
 * `delta` for arguments that offset the atomic value (e.g., `Add`).
 * `old`, `new` for arguments to `CAS`.
 * `old` named return from `Swap`.
 * `swapped` for named return from `CAS`.

This also matches the names used in the stdlib atomic interface:
https://golang.org/pkg/sync/atomic/
2021-06-11 10:20:12 -07:00
Prashant Varanasi
df5a5c3c08 Add Swap for Float64 (#94)
Float64 wraps a Uint64, and since Uint64 supports Swap, Float64 can also
support Swap. Enable the Swap method in the generated code, and add
tests.

This also adds a note for why String doesn't support Swap (though it
will be possible after Go 1.17+).
2021-06-11 08:23:41 -07:00
Prashant Varanasi
38b6e7fa63 Add note on Float64.CAS matching of NaN (#95)
NaN != NaN when using Go's inbuilt operator, but the same is not true
when used with Float64.CAS. Add a note calling this out.

Changing this would be a behaviour change (requires a major version
bump), and is likely unsafe as it could lead to typical CAS loops
blocking forever.

To add the note, we copy the generated CAS method and extend the
documentation as the generator does not support per-method
customizations on the doc comments.
2021-06-11 08:16:20 -07:00
Abhinav Gupta
e63519f6ea float64: Generate with gen-atomicwrapper
Generate atomic.Float64 with gen-valuewrapper by wrapping atomic.Uint64,
using math.Float64bits and math.Float64frombits to pack and unpack
float64 to uint64.
2020-05-15 15:47:25 -07:00