pitrou commented on a change in pull request #11789:
URL: https://github.com/apache/arrow/pull/11789#discussion_r763085828



##########
File path: cpp/src/arrow/util/ubsan.h
##########
@@ -52,20 +52,42 @@ inline T* MakeNonNull(T* maybe_null = NULLPTR) {
   return const_cast<T*>(reinterpret_cast<const T*>(&internal::kNonNullFiller));
 }
 
+// SafeLoadAs with a specific number of bytes
+// The returned bytes whose position is greater than `num_bytes` will be 
initialized to 0
+template <typename T>
+inline typename std::enable_if<std::is_trivial<T>::value, T>::type SafeLoadAs(
+    const uint8_t* unaligned, uint32_t num_bytes) {

Review comment:
       Hmm, looking at the tests, I have a question: what is the desired 
semantics on big-endian machine? It seems this would happily return a value 
with only high bits set. Shouldn't it be the converse (only low bits set)?




-- 
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]


Reply via email to