Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
with:
profile: minimal
toolchain: 1.41.1
default: true
- name: Install maturin, poetry, and toml
run: pip install maturin poetry toml
- name: Create an isolated example directory
Expand Down
4 changes: 2 additions & 2 deletions src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ where
let (strides, dim) = (self.npy_strides(), self.raw_dim());
let orig_ptr = self.as_ptr();
// Element of which size is 0 is not supported, but check it for future changes
let is_empty_or_size0 = self.is_empty() || std::mem::size_of::<Self::Item>() == 0;
let is_empty_or_size0 = self.is_empty() || std::mem::size_of::<A>() == 0;
let vec = self.into_raw_vec();
let offset = if is_empty_or_size0 {
0
} else {
unsafe { orig_ptr.offset_from(vec.as_ptr()) as usize }
(orig_ptr as usize - vec.as_ptr() as usize) / std::mem::size_of::<A>()
};
let mut boxed_slice = vec.into_boxed_slice();
// data_ptr is not always the pointer to the 1st element.
Expand Down