Skip to content

Commit 9bda993

Browse files
committed
replace loop with another OnesCount8
1 parent c87d6f3 commit 9bda993

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

replication/row_event.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,8 @@ func (e *RowsEvent) decodeImage(data []byte, bitmap []byte, rowImageType EnumRow
11541154
for ; col+8 <= int(e.ColumnCount); col += 8 {
11551155
count += bits.OnesCount8(bitmap[col>>3])
11561156
}
1157-
for ; col < int(e.ColumnCount); col++ {
1158-
if isBitSet(bitmap, col) {
1159-
count++
1160-
}
1157+
if col < int(e.ColumnCount) {
1158+
count += bits.OnesCount8(bitmap[col>>3] & byte((1<<int(e.ColumnCount)-col)-1))
11611159
}
11621160
skips := make([]int, 0, int(e.ColumnCount)-count)
11631161
count = bitmapByteSize(count)

0 commit comments

Comments
 (0)