From 9fde2809cca131e3da1a7e0920ea151029301fb4 Mon Sep 17 00:00:00 2001 From: spinlock Date: Thu, 28 Dec 2017 13:21:29 +0000 Subject: [PATCH] utils: update atomic2.Int64 --- pkg/utils/sync2/atomic2/atomic64.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkg/utils/sync2/atomic2/atomic64.go b/pkg/utils/sync2/atomic2/atomic64.go index 288e45dae..4f059d538 100644 --- a/pkg/utils/sync2/atomic2/atomic64.go +++ b/pkg/utils/sync2/atomic2/atomic64.go @@ -5,12 +5,10 @@ package atomic2 import "sync/atomic" -type Int64 struct { - v int64 -} +type Int64 int64 func (a *Int64) Int64() int64 { - return atomic.LoadInt64(&a.v) + return atomic.LoadInt64((*int64)(a)) } func (a *Int64) AsInt() int { @@ -18,19 +16,19 @@ func (a *Int64) AsInt() int { } func (a *Int64) Set(v int64) { - atomic.StoreInt64(&a.v, v) + atomic.StoreInt64((*int64)(a), v) } func (a *Int64) CompareAndSwap(o, n int64) bool { - return atomic.CompareAndSwapInt64(&a.v, o, n) + return atomic.CompareAndSwapInt64((*int64)(a), o, n) } func (a *Int64) Swap(v int64) int64 { - return atomic.SwapInt64(&a.v, v) + return atomic.SwapInt64((*int64)(a), v) } func (a *Int64) Add(v int64) int64 { - return atomic.AddInt64(&a.v, v) + return atomic.AddInt64((*int64)(a), v) } func (a *Int64) Sub(v int64) int64 {