From 648a3205bd149ec64340926445e94d0cde1ae24d Mon Sep 17 00:00:00 2001 From: Johann Sebastian Schicho Date: Sun, 5 Sep 2021 17:56:57 +0200 Subject: [PATCH] remove unnecessary casts --- bool.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bool.go b/bool.go index 6e8c509..87256b7 100644 --- a/bool.go +++ b/bool.go @@ -30,17 +30,17 @@ type AtomicBool struct { // Set sets the Boolean to true. func (ab *AtomicBool) Set() { - atomic.StoreInt32((*int32)(&ab.boolean), 1) + atomic.StoreInt32(&ab.boolean, 1) } // UnSet sets the Boolean to false. func (ab *AtomicBool) UnSet() { - atomic.StoreInt32((*int32)(&ab.boolean), 0) + atomic.StoreInt32(&ab.boolean, 0) } // IsSet returns whether the Boolean is true. func (ab *AtomicBool) IsSet() bool { - return atomic.LoadInt32((*int32)(&ab.boolean))&1 == 1 + return atomic.LoadInt32(&ab.boolean)&1 == 1 } // IsNotSet returns whether the Boolean is false. @@ -51,9 +51,9 @@ func (ab *AtomicBool) IsNotSet() bool { // SetTo sets the boolean with given Boolean. func (ab *AtomicBool) SetTo(yes bool) { if yes { - atomic.StoreInt32((*int32)(&ab.boolean), 1) + atomic.StoreInt32(&ab.boolean, 1) } else { - atomic.StoreInt32((*int32)(&ab.boolean), 0) + atomic.StoreInt32(&ab.boolean, 0) } } @@ -79,7 +79,7 @@ func (ab *AtomicBool) SetToIf(old, new bool) (set bool) { if new { n = 1 } - return atomic.CompareAndSwapInt32((*int32)(&ab.boolean), o, n) + return atomic.CompareAndSwapInt32(&ab.boolean, o, n) } // MarshalJSON behaves the same as if the AtomicBool is a builtin.bool.