mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 02:12:25 -05: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:
parent
4a3ece0c6c
commit
865b3aeaac
4 changed files with 36 additions and 28 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue