1 package xsync
2 3 import (
4 "sync/atomic"
5 )
6 7 // Int64 represents an atomic int64.
8 type Int64 struct {
9 // We do not use atomic.Load/StoreInt64 since it does not
10 // work on 32 bit computers but we need 64 bit integers.
11 i atomic.Value
12 }
13 14 // Load loads the int64.
15 func (v *Int64) Load() int64 {
16 i, _ := v.i.Load().(int64)
17 return i
18 }
19 20 // Store stores the int64.
21 func (v *Int64) Store(i int64) {
22 v.i.Store(i)
23 }
24