WillAyd commented on PR #763:
URL: https://github.com/apache/arrow-nanoarrow/pull/763#issuecomment-2935648864
Yea I don't think it is correct - from my understanding the static analysis
of the code block:
```c
static inline void ArrowBitmapAppendInt8Unsafe(struct ArrowBitmap* bitmap,
const int8_t* values, int64_t
n_values) {
if (n_values == 0) {
return;
}
NANOARROW_DCHECK(bitmap->buffer.data != NULL);
NANOARROW_DCHECK(values != NULL);
const int8_t* values_cursor = values;
int64_t n_remaining = n_values;
int64_t out_i_cursor = bitmap->size_bits;
uint8_t* out_cursor = bitmap->buffer.data + bitmap->size_bits / 8;
// First byte
if ((out_i_cursor % 8) != 0) {
int64_t n_partial_bits = _ArrowRoundUpToMultipleOf8(out_i_cursor) -
out_i_cursor;
for (int i = 0; i < n_partial_bits; i++) {
ArrowBitSetTo(bitmap->buffer.data, out_i_cursor++, values[i]);
}
out_cursor++;
values_cursor += n_partial_bits;
n_remaining -= n_partial_bits;
}
// Middle bytes
int64_t n_full_bytes = n_remaining / 8;
for (int64_t i = 0; i < n_full_bytes; i++) {
_ArrowBitmapPackInt8(values_cursor, out_cursor);
values_cursor += 8;
out_cursor++;
}
...
```
is misunderstanding (?) that the `for (int64_t i = 0; i < n_full_bytes; i++)
{` branch will never be executed, because we are passing in `n_values` of 7
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]