Currently SpatialDims::from(n: isize) would assert n > 0. This would disallow a 0 sized offset, and was only for isize, not for any other type. I changed this to call to_usize on signed types and a cast to usize for unsigned types. Also implemented FromPrimitive by mapping the ToPrimitive::to_usize implementation. I checked that the issue on my end was fixed by either forcing 0 as usize or the changes here.
To reproduce:
use ocl::SpatialDims;
SpatialDims::from(0 as i32); // fine
SpatialDims::from(0 as usize); // fine
SpatialDims::from(0 as isize); // panics
Currently SpatialDims::from(n: isize) would assert n > 0. This would disallow a 0 sized offset, and was only for isize, not for any other type. I changed this to call to_usize on signed types and a cast to usize for unsigned types. Also implemented FromPrimitive by mapping the ToPrimitive::to_usize implementation. I checked that the issue on my end was fixed by either forcing 0 as usize or the changes here.
To reproduce: