File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -5,32 +5,30 @@ package atomic2
5
5
6
6
import "sync/atomic"
7
7
8
- type Int64 struct {
9
- v int64
10
- }
8
+ type Int64 int64
11
9
12
10
func (a * Int64 ) Int64 () int64 {
13
- return atomic .LoadInt64 (& a . v )
11
+ return atomic .LoadInt64 (( * int64 )( a ) )
14
12
}
15
13
16
14
func (a * Int64 ) AsInt () int {
17
15
return int (a .Int64 ())
18
16
}
19
17
20
18
func (a * Int64 ) Set (v int64 ) {
21
- atomic .StoreInt64 (& a . v , v )
19
+ atomic .StoreInt64 (( * int64 )( a ) , v )
22
20
}
23
21
24
22
func (a * Int64 ) CompareAndSwap (o , n int64 ) bool {
25
- return atomic .CompareAndSwapInt64 (& a . v , o , n )
23
+ return atomic .CompareAndSwapInt64 (( * int64 )( a ) , o , n )
26
24
}
27
25
28
26
func (a * Int64 ) Swap (v int64 ) int64 {
29
- return atomic .SwapInt64 (& a . v , v )
27
+ return atomic .SwapInt64 (( * int64 )( a ) , v )
30
28
}
31
29
32
30
func (a * Int64 ) Add (v int64 ) int64 {
33
- return atomic .AddInt64 (& a . v , v )
31
+ return atomic .AddInt64 (( * int64 )( a ) , v )
34
32
}
35
33
36
34
func (a * Int64 ) Sub (v int64 ) int64 {
You can’t perform that action at this time.
0 commit comments