summaryrefslogtreecommitdiffstats
path: root/vendor/go.uber.org/atomic/float64.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/go.uber.org/atomic/float64.go')
-rw-r--r--vendor/go.uber.org/atomic/float64.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/vendor/go.uber.org/atomic/float64.go b/vendor/go.uber.org/atomic/float64.go
index f833fd37..8a136718 100644
--- a/vendor/go.uber.org/atomic/float64.go
+++ b/vendor/go.uber.org/atomic/float64.go
@@ -37,10 +37,10 @@ type Float64 struct {
var _zeroFloat64 float64
// NewFloat64 creates a new Float64.
-func NewFloat64(v float64) *Float64 {
+func NewFloat64(val float64) *Float64 {
x := &Float64{}
- if v != _zeroFloat64 {
- x.Store(v)
+ if val != _zeroFloat64 {
+ x.Store(val)
}
return x
}
@@ -51,13 +51,14 @@ func (x *Float64) Load() float64 {
}
// Store atomically stores the passed float64.
-func (x *Float64) Store(v float64) {
- x.v.Store(math.Float64bits(v))
+func (x *Float64) Store(val float64) {
+ x.v.Store(math.Float64bits(val))
}
-// CAS is an atomic compare-and-swap for float64 values.
-func (x *Float64) CAS(o, n float64) bool {
- return x.v.CAS(math.Float64bits(o), math.Float64bits(n))
+// Swap atomically stores the given float64 and returns the old
+// value.
+func (x *Float64) Swap(val float64) (old float64) {
+ return math.Float64frombits(x.v.Swap(math.Float64bits(val)))
}
// MarshalJSON encodes the wrapped float64 into JSON.