You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/11 16:34:16 UTC

[GitHub] [arrow-rs] sunchao commented on a change in pull request #1421: Fix possibly unaligned writes in MutableBuffer

sunchao commented on a change in pull request #1421:
URL: https://github.com/apache/arrow-rs/pull/1421#discussion_r824881391



##########
File path: arrow/src/buffer/mutable.rs
##########
@@ -710,6 +713,46 @@ mod tests {
         );
     }
 
+    #[test]
+    fn mutable_extend_from_iter_unaligned_u64() {
+        let mut buf = MutableBuffer::new(16);
+        buf.push(1_u8);
+        buf.extend([1_u64]);
+        dbg!(&buf.as_slice());
+        assert_eq!(9, buf.len());
+        assert_eq!(&[1u8, 1u8, 0, 0, 0, 0, 0, 0, 0], buf.as_slice());
+    }
+
+    #[test]
+    fn mutable_extend_from_slice_unaligned_u64() {
+        let mut buf = MutableBuffer::new(16);
+        buf.extend_from_slice(&[1_u8]);
+        buf.extend_from_slice(&[1_u64]);
+        dbg!(&buf.as_slice());

Review comment:
       nit: is this needed?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org