bjchambers opened a new issue #807:
URL: https://github.com/apache/arrow-rs/issues/807


   **Describe the bug**
   Because `buf.bit_slice(...)` falls back to a slice that ignores the length 
when the offset is byte-aligned, the resulting buffer has an incorrect length. 
This leads to problems when applying bitwise operations such as `&`, for 
instance.
   
   **To Reproduce**
   
   The following test fails:
   
   ```
       #[test]
       fn test_bit_slice_aligned() {
           let buf = Buffer::from(&[2, 4, 6, 8, 10]);
           let slice = buf.bit_slice(8, 8);
           let expected = Buffer::from(&[4]);
           assert_eq!(slice.len(), 1); // actual length is 4!!
           assert_eq!(&slice, &expected);
       }
   ```
   
   **Expected behavior**
   Test passes.
   
   **Additional context**
   Add any other context about the problem here.
   


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