Skip to content

Commit

Permalink
minor bug fix in bit_array::fill_stream
Browse files Browse the repository at this point in the history
  • Loading branch information
yas-sim committed Sep 16, 2023
1 parent 088f0e9 commit 8f20216
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fdc_bitstream/bit_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,9 @@ size_t bit_array::distance_to_next_pulse(void) {
* @param length Number of bits to fill.
*/
void bit_array::fill_stream(int start_pos, int end_pos, uint8_t data) {
if(start_pos >= m_bit_length) return;
if(end_pos >= m_bit_length) return;
if(start_pos >= m_bit_length) start_pos = m_bit_length - 1;
if(end_pos >= m_bit_length) end_pos = m_bit_length - 1;
if(start_pos >= end_pos) return;
for (int i = start_pos; i < end_pos; i++) {
set(i, data);
}
Expand Down

0 comments on commit 8f20216

Please sign in to comment.