You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by gi...@apache.org on 2023/06/19 18:23:29 UTC
[arrow-nanoarrow] branch main updated: Update dist/ for commit e811cfe15a3989341702777276e594206bbfa37d
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 3b5986c Update dist/ for commit e811cfe15a3989341702777276e594206bbfa37d
3b5986c is described below
commit 3b5986c929bb04eabcdee54a5cc1c9ee50e12413
Author: GitHub Actions <ac...@github.com>
AuthorDate: Mon Jun 19 18:23:24 2023 +0000
Update dist/ for commit e811cfe15a3989341702777276e594206bbfa37d
---
dist/nanoarrow.h | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/dist/nanoarrow.h b/dist/nanoarrow.h
index 227ee2d..05dcc19 100644
--- a/dist/nanoarrow.h
+++ b/dist/nanoarrow.h
@@ -2153,36 +2153,37 @@ static inline int64_t ArrowBitCountSet(const uint8_t* bits, int64_t start_offset
const int64_t i_begin = start_offset;
const int64_t i_end = start_offset + length;
+ const int64_t i_last_valid = i_end - 1;
const int64_t bytes_begin = i_begin / 8;
- const int64_t bytes_end = i_end / 8 + 1;
+ const int64_t bytes_last_valid = i_last_valid / 8;
- if (bytes_end == bytes_begin + 1) {
+ if (bytes_begin == bytes_last_valid) {
// count bits within a single byte
const uint8_t first_byte_mask = _ArrowkPrecedingBitmask[i_end % 8];
const uint8_t last_byte_mask = _ArrowkTrailingBitmask[i_begin % 8];
const uint8_t only_byte_mask =
- i_end % 8 == 0 ? first_byte_mask : (uint8_t)(first_byte_mask & last_byte_mask);
+ i_end % 8 == 0 ? last_byte_mask : (uint8_t)(first_byte_mask & last_byte_mask);
const uint8_t byte_masked = bits[bytes_begin] & only_byte_mask;
return _ArrowkBytePopcount[byte_masked];
}
const uint8_t first_byte_mask = _ArrowkPrecedingBitmask[i_begin % 8];
- const uint8_t last_byte_mask = _ArrowkTrailingBitmask[i_end % 8];
+ const uint8_t last_byte_mask = i_end % 8 == 0 ? 0 : _ArrowkTrailingBitmask[i_end % 8];
int64_t count = 0;
// first byte
count += _ArrowkBytePopcount[bits[bytes_begin] & ~first_byte_mask];
// middle bytes
- for (int64_t i = bytes_begin + 1; i < (bytes_end - 1); i++) {
+ for (int64_t i = bytes_begin + 1; i < bytes_last_valid; i++) {
count += _ArrowkBytePopcount[bits[i]];
}
// last byte
- count += _ArrowkBytePopcount[bits[bytes_end - 1] & ~last_byte_mask];
+ count += _ArrowkBytePopcount[bits[bytes_last_valid] & ~last_byte_mask];
return count;
}