diff options
author | 2024-09-26 19:23:41 +0000 | |
---|---|---|
committer | 2024-09-26 19:23:41 +0000 | |
commit | f3e2d36d6455e6d16aba833bdf64806377c8178f (patch) | |
tree | 8a1e87f349205e8073b72df6e5349c553db80a17 /vendor/codeberg.org/gruf/go-atomics/int.go | |
parent | [chore] Fix some contrast issues in themes; performance tweaks (#3358) (diff) | |
download | gotosocial-f3e2d36d6455e6d16aba833bdf64806377c8178f.tar.xz |
[chore] update go-sched pkg (#3357)
* update go-sched to v1.2.4 which removes some now unused dependencies
* whoops, remove test output
Diffstat (limited to 'vendor/codeberg.org/gruf/go-atomics/int.go')
-rw-r--r-- | vendor/codeberg.org/gruf/go-atomics/int.go | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/vendor/codeberg.org/gruf/go-atomics/int.go b/vendor/codeberg.org/gruf/go-atomics/int.go deleted file mode 100644 index 019ca1034..000000000 --- a/vendor/codeberg.org/gruf/go-atomics/int.go +++ /dev/null @@ -1,69 +0,0 @@ -package atomics - -import "sync/atomic" - -// Int32 provides user-friendly means of performing atomic operations on int32 types. -type Int32 int32 - -// NewInt32 will return a new Int32 instance initialized with zero value. -func NewInt32() *Int32 { - return new(Int32) -} - -// Add will atomically add int32 delta to value in address contained within i, returning new value. -func (i *Int32) Add(delta int32) int32 { - return atomic.AddInt32((*int32)(i), delta) -} - -// Store will atomically store int32 value in address contained within i. -func (i *Int32) Store(val int32) { - atomic.StoreInt32((*int32)(i), val) -} - -// Load will atomically load int32 value at address contained within i. -func (i *Int32) Load() int32 { - return atomic.LoadInt32((*int32)(i)) -} - -// CAS performs a compare-and-swap for a(n) int32 value at address contained within i. -func (i *Int32) CAS(cmp, swp int32) bool { - return atomic.CompareAndSwapInt32((*int32)(i), cmp, swp) -} - -// Swap atomically stores new int32 value into address contained within i, and returns previous value. -func (i *Int32) Swap(swp int32) int32 { - return atomic.SwapInt32((*int32)(i), swp) -} - -// Int64 provides user-friendly means of performing atomic operations on int64 types. -type Int64 int64 - -// NewInt64 will return a new Int64 instance initialized with zero value. -func NewInt64() *Int64 { - return new(Int64) -} - -// Add will atomically add int64 delta to value in address contained within i, returning new value. -func (i *Int64) Add(delta int64) int64 { - return atomic.AddInt64((*int64)(i), delta) -} - -// Store will atomically store int64 value in address contained within i. -func (i *Int64) Store(val int64) { - atomic.StoreInt64((*int64)(i), val) -} - -// Load will atomically load int64 value at address contained within i. -func (i *Int64) Load() int64 { - return atomic.LoadInt64((*int64)(i)) -} - -// CAS performs a compare-and-swap for a(n) int64 value at address contained within i. -func (i *Int64) CAS(cmp, swp int64) bool { - return atomic.CompareAndSwapInt64((*int64)(i), cmp, swp) -} - -// Swap atomically stores new int64 value into address contained within i, and returns previous value. -func (i *Int64) Swap(swp int64) int64 { - return atomic.SwapInt64((*int64)(i), swp) -} |