[bugfix] updated pinned counts on status delete (#3188)

* include pinned status when incrementing / decrementing status counts

* remove the pinned increment on status creation

* code comments

* microoptimize decr
This commit is contained in:
kim 2024-08-11 09:23:36 +00:00 committed by GitHub
commit 865b3aeaac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 28 deletions

View file

@ -23,6 +23,15 @@ type Number interface {
~uintptr | ~float32 | ~float64
}
// Decr performs a safe decrement of
// n, clamping minimum value at zero.
func Decr[N Number](n N) N {
if n <= 0 {
return 0
}
return n - 1
}
// Div performs a safe division of
// n1 and n2, checking for zero n2. In the
// case of zero n2, zero is returned.