Skip to content

Commit 5308593

Browse files
committed
👷 tidy up comments in rle_codec.hpp
1 parent 59c0594 commit 5308593

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

include/msg/detail/rle_codec.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ template <typename BitSetType> class rle_decoder {
5555
// - a positive number for the number of consecutive 1's
5656
// - zero if there are no more bits to decode
5757
//
58-
// This encoding is to support efficient intersection using a min-heap
59-
//
6058
// Can traverse only a single time.
6159
class chunk_enumerator {
6260
public:
@@ -70,18 +68,14 @@ template <typename BitSetType> class rle_decoder {
7068
}
7169

7270
// Get the current chunk of continuous bits. -ve values are 0s
73-
// +ve values are 1s. range is -255...255. will return 0 if
71+
// +ve values are 1s. range is -255...255. will return 0 if finished
7472
[[nodiscard]] constexpr auto bit_chunk() const -> std::int_fast16_t {
7573
return bit_value ? current_run : -current_run;
7674
}
7775

7876
// Advance the bit chunk by the given number of bits. This might consume
7977
// only a portion of the remain bits in the chunk, skip to the next
8078
// chunk or skip over multiple chunks.
81-
//
82-
// Note: No bounds checking is done for efficiency
83-
// The caller is responsible for ensuring that the bitset bounds
84-
// are not exceeded while consuming data.
8579
constexpr void advance(std::size_t bits) {
8680
while (bits > 0 && bits_remaining > 0) {
8781
// more available than we are consuming?
@@ -115,7 +109,7 @@ template <typename BitSetType> class rle_decoder {
115109
return;
116110
}
117111

118-
// skipping the next bit for a >255 run?
112+
// skipping the next bit count for a > 255 run?
119113
if (*rle_data == std::byte{0}) {
120114
// keep same bit_value and skip this encoded byte
121115
++rle_data;
@@ -250,7 +244,7 @@ struct rle_intersect {
250244
// chunks must also be 1s.
251245
advance(static_cast<std::size_t>(chunk));
252246
while (chunk-- > 0) {
253-
// call F, but abort if returns false
247+
// call F, but abort if it indicates abort requested
254248
if (f(bit++)) {
255249
return true; // early abort
256250
}
@@ -296,6 +290,7 @@ struct rle_intersect {
296290
}
297291
};
298292

293+
// at least 1 decoder is required
299294
template <typename Decoder, std::same_as<Decoder>... Others>
300295
rle_intersect(Decoder &&d, Others &&...others)
301296
-> rle_intersect<typename Decoder::bitset_type, Decoder, Others...>;

0 commit comments

Comments
 (0)