summaryrefslogtreecommitdiffstats
path: root/src/libnetdata
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-10 20:12:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-10 20:12:09 +0000
commit18fcf4e9717a2b3809a032003842c45107f5b59a (patch)
treee55aed1f1feb4e114e3a5b89763766e781cbc831 /src/libnetdata
parentAdding upstream version 1.47.0. (diff)
downloadnetdata-18fcf4e9717a2b3809a032003842c45107f5b59a.tar.xz
netdata-18fcf4e9717a2b3809a032003842c45107f5b59a.zip
Adding upstream version 1.47.1.upstream/1.47.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/libnetdata/gorilla/gorilla.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libnetdata/gorilla/gorilla.cc b/src/libnetdata/gorilla/gorilla.cc
index c76018365..e3d612418 100644
--- a/src/libnetdata/gorilla/gorilla.cc
+++ b/src/libnetdata/gorilla/gorilla.cc
@@ -162,10 +162,11 @@ bool gorilla_writer_write(gorilla_writer_t *gw, uint32_t number)
__atomic_fetch_add(&hdr->nbits, 1, __ATOMIC_RELAXED);
if (!is_xor_lzc_same) {
- if (hdr->nbits + 1 >= gw->capacity)
+ size_t bits_needed = (bit_size<uint32_t>() == 32) ? 5 : 6;
+ if ((hdr->nbits + bits_needed) >= gw->capacity)
return false;
- bit_buffer_write(data, hdr->nbits, xor_lzc, (bit_size<uint32_t>() == 32) ? 5 : 6);
- __atomic_fetch_add(&hdr->nbits, (bit_size<uint32_t>() == 32) ? 5 : 6, __ATOMIC_RELAXED);
+ bit_buffer_write(data, hdr->nbits, xor_lzc, bits_needed);
+ __atomic_fetch_add(&hdr->nbits, bits_needed, __ATOMIC_RELAXED);
}
// write the bits of the XOR'd value without the LZC prefix