Calculate the number of bytes required in the bit-packed validity buffer.
| 26 | |
| 27 | // Calculate the number of bytes required in the bit-packed validity buffer. |
| 28 | int64_t packedLength(int64_t num_elements) { |
| 29 | // Since MATLAB logical values are encoded using a full byte (8 bits), |
| 30 | // we can divide the number of elements in the logical array by 8 to get |
| 31 | // the bit packed length. |
| 32 | return static_cast<int64_t>(std::ceil(num_elements / 8.0)); |
| 33 | } |
| 34 | |
| 35 | arrow::Result<std::shared_ptr<arrow::Buffer>> packValid( |
| 36 | const ::matlab::data::TypedArray<bool> matlab_logical_array) { |