Skip to content

Commit b432b85

Browse files
minor optimization in DNA four bit operations
1 parent 81b0063 commit b432b85

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dna_four_bit.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ struct genome_four_bit_itr {
127127
}
128128
genome_four_bit_itr operator+(const size_t step) const {
129129
// whether the sum of offsets is >= 16
130-
const bool shift_one_pos = (offset + (step & 15ul) >= 16);
130+
const bool shift_one_pos =
131+
(((offset + (static_cast<int>(step) & 15)) & 16) >> 4);
131132

132-
const size_t new_offset = (offset + step) & 15ul;
133+
const int new_offset = (offset + step) & 15;
133134
return genome_four_bit_itr(itr + step/16 + shift_one_pos,
134135
new_offset);
135136
}

0 commit comments

Comments
 (0)