We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0215d0 commit 405703dCopy full SHA for 405703d
internal/atomicx/atomicx.go
@@ -45,6 +45,14 @@ type Sum struct {
45
f [2]atomic.Uint64
46
}
47
48
+func (x *Sum) Inc() {
49
+ x.i.Add(1)
50
+}
51
+
52
+func (x *Sum) Dec() {
53
+ x.i.Add(^uint64(0))
54
55
56
func (x *Sum) AddUint64(val uint64) {
57
if val == 0 {
58
return
@@ -57,6 +65,11 @@ func (x *Sum) Add(val float64) {
65
66
59
67
68
+ if val == 1 {
69
+ x.Inc()
70
+ return
71
+ }
72
60
73
// if we're less than 1, we must be a float
61
74
if val >= 1 {
62
75
// Fast path to first check if the value is actually a whole number in
0 commit comments