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

Function SafeLoadAs

cpp/src/arrow/util/ubsan.h:57–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56template <typename T>
57inline std::enable_if_t<std::is_trivially_copyable_v<T>, T> SafeLoadAs(
58 const uint8_t* unaligned) {
59 using Type = std::remove_const_t<T>;
60 arrow::internal::AlignedStorage<Type> raw_data;
61 std::memcpy(raw_data.get(), unaligned, sizeof(T));
62 auto data = *raw_data.get();
63 raw_data.destroy();
64 return data;
65}
66
67template <typename T>
68inline std::enable_if_t<std::is_trivially_copyable_v<T>, T> SafeLoad(const T* unaligned) {

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected