mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user