summaryrefslogtreecommitdiffhomepage
path: root/misc.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-03 19:04:00 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-05 12:59:42 +0100
commit89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7 (patch)
treee19022fe717ddfb840599bf68e4c5a9268f8c278 /misc.go
parentdff424baf8acc4d2a5858d3947761c5090d8e640 (diff)
Extend structs rather than embed, when possible
Diffstat (limited to 'misc.go')
-rw-r--r--misc.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc.go b/misc.go
index c4f1d74..6786cb5 100644
--- a/misc.go
+++ b/misc.go
@@ -17,11 +17,11 @@ const (
)
type AtomicBool struct {
- flag int32
+ int32
}
func (a *AtomicBool) Get() bool {
- return atomic.LoadInt32(&a.flag) == AtomicTrue
+ return atomic.LoadInt32(&a.int32) == AtomicTrue
}
func (a *AtomicBool) Swap(val bool) bool {
@@ -29,7 +29,7 @@ func (a *AtomicBool) Swap(val bool) bool {
if val {
flag = AtomicTrue
}
- return atomic.SwapInt32(&a.flag, flag) == AtomicTrue
+ return atomic.SwapInt32(&a.int32, flag) == AtomicTrue
}
func (a *AtomicBool) Set(val bool) {
@@ -37,7 +37,7 @@ func (a *AtomicBool) Set(val bool) {
if val {
flag = AtomicTrue
}
- atomic.StoreInt32(&a.flag, flag)
+ atomic.StoreInt32(&a.int32, flag)
}
func min(a, b uint) uint {