Align the bit offset into the buffer with the front of the buffer by shifting the buffer and eliminating the offset.
(
buf: "pyarrow.Buffer",
bit_offset: int,
byte_length: int,
)
| 748 | |
| 749 | |
| 750 | def _align_bit_offset( |
| 751 | buf: "pyarrow.Buffer", |
| 752 | bit_offset: int, |
| 753 | byte_length: int, |
| 754 | ) -> "pyarrow.Buffer": |
| 755 | """Align the bit offset into the buffer with the front of the buffer by shifting |
| 756 | the buffer and eliminating the offset. |
| 757 | """ |
| 758 | import pyarrow as pa |
| 759 | |
| 760 | bytes_ = buf.to_pybytes() |
| 761 | bytes_as_int = int.from_bytes(bytes_, sys.byteorder) |
| 762 | bytes_as_int >>= bit_offset |
| 763 | bytes_ = bytes_as_int.to_bytes(byte_length, sys.byteorder) |
| 764 | return pa.py_buffer(bytes_) |
| 765 | |
| 766 | |
| 767 | def _arrow_table_ipc_reduce(table: "pyarrow.Table"): |
searching dependent graphs…