MCPcopy Create free account
hub / github.com/apache/arrow / StaticCastBuffer

Function StaticCastBuffer

python/pyarrow/src/arrow/python/numpy_to_arrow.cc:368–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366
367template <typename FromType, typename ToType>
368Status StaticCastBuffer(const Buffer& input, const int64_t length, MemoryPool* pool,
369 std::shared_ptr<Buffer>* out) {
370 ARROW_ASSIGN_OR_RAISE(auto result, AllocateBuffer(sizeof(ToType) * length, pool));
371
372 auto in_values = reinterpret_cast<const FromType*>(input.data());
373 auto out_values = reinterpret_cast<ToType*>(result->mutable_data());
374 for (int64_t i = 0; i < length; ++i) {
375 *out_values++ = static_cast<ToType>(*in_values++);
376 }
377 *out = std::move(result);
378 return Status::OK();
379}
380
381template <typename T>
382void CopyStridedBytewise(int8_t* input_data, int64_t length, int64_t stride,

Callers

nothing calls this directly

Calls 3

OKFunction · 0.50
dataMethod · 0.45
mutable_dataMethod · 0.45

Tested by

no test coverage detected