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 72d13f58 Update dist/ for commit
9f75836a932aa38f43ad02af48bbddeab06453f6
72d13f58 is described below
commit 72d13f589279b4694e273e982958668f61bae927
Author: GitHub Actions <[email protected]>
AuthorDate: Thu May 16 01:28:59 2024 +0000
Update dist/ for commit 9f75836a932aa38f43ad02af48bbddeab06453f6
---
dist/nanoarrow.h | 21 +++++++++++++++++++++
dist/nanoarrow.hpp | 15 ++++++++-------
2 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/dist/nanoarrow.h b/dist/nanoarrow.h
index 7d8de2dc..3825e78a 100644
--- a/dist/nanoarrow.h
+++ b/dist/nanoarrow.h
@@ -2203,6 +2203,27 @@ static inline int64_t ArrowResolveChunk64(int64_t index,
const int64_t* offsets,
return lo;
}
+static inline int64_t ArrowResolveChunk32(int32_t index, const int32_t*
offsets,
+ int32_t lo, int32_t hi) {
+ // Similar to std::upper_bound(), but slightly different as our offsets
+ // array always starts with 0.
+ int32_t n = hi - lo;
+ // First iteration does not need to check for n > 1
+ // (lo < hi is guaranteed by the precondition).
+ NANOARROW_DCHECK(n > 1);
+ do {
+ const int32_t m = n >> 1;
+ const int32_t mid = lo + m;
+ if (index >= offsets[mid]) {
+ lo = mid;
+ n -= m;
+ } else {
+ n = m;
+ }
+ } while (n > 1);
+ return lo;
+}
+
static inline int64_t _ArrowGrowByFactor(int64_t current_capacity, int64_t
new_capacity) {
int64_t doubled_capacity = current_capacity * 2;
if (doubled_capacity > new_capacity) {
diff --git a/dist/nanoarrow.hpp b/dist/nanoarrow.hpp
index a0459b41..0de2371b 100644
--- a/dist/nanoarrow.hpp
+++ b/dist/nanoarrow.hpp
@@ -556,11 +556,11 @@ struct Nothing {};
template <typename T>
class Maybe {
public:
- Maybe() : nothing_{Nothing{}}, is_something_{false} {}
- Maybe(Nothing) : Maybe{} {}
+ Maybe() : nothing_(Nothing()), is_something_(false) {}
+ Maybe(Nothing) : Maybe() {}
Maybe(T something) // NOLINT(google-explicit-constructor)
- : something_{something}, is_something_{true} {}
+ : something_(something), is_something_(true) {}
explicit constexpr operator bool() const { return is_something_; }
@@ -575,7 +575,8 @@ class Maybe {
T value_or(T val) const { return is_something_ ? something_ : val; }
private:
- static_assert(std::is_trivially_copyable<T>::value, "");
+ // When support for gcc 4.8 is dropped, we should also assert
+ // is_trivially_copyable<T>::value
static_assert(std::is_trivially_destructible<T>::value, "");
union {
@@ -631,7 +632,7 @@ struct InputRange {
};
iterator begin() { return {this, next()}; }
- iterator end() { return {this, {}}; }
+ iterator end() { return {this, ValueOrFalsy()}; }
};
} // namespace internal
@@ -825,7 +826,7 @@ class ViewArrayAsFixedSizeBytes {
class ViewArrayStream {
public:
ViewArrayStream(ArrowArrayStream* stream, ArrowErrorCode* code, ArrowError*
error)
- : range_{Next{this, stream, UniqueArray{}}}, code_{code}, error_{error}
{}
+ : range_{Next{this, stream, UniqueArray()}}, code_{code}, error_{error}
{}
ViewArrayStream(ArrowArrayStream* stream, ArrowError* error)
: ViewArrayStream{stream, &internal_code_, error} {}
@@ -905,7 +906,7 @@ inline bool operator==(ArrowStringView l, ArrowStringView
r) {
}
/// \brief User literal operator allowing ArrowStringView construction like
"str"_sv
-inline ArrowStringView operator""_v(const char* data, std::size_t size_bytes) {
+inline ArrowStringView operator"" _v(const char* data, std::size_t size_bytes)
{
return {data, static_cast<int64_t>(size_bytes)};
}
/// @}