Created by: corco
This fix the function useful_array when unaligned and dtype's size is 2 or more bytes. See the added test that fails with previous' function.
The issue is that the current fonction crops the numpy array using sizes in bytes instead of in number of array elements. When dtype is not a byte, the wrong cropping occurs.
There are several way to fix the function, such as expressing total_line_size
and useful_line_size
in number of elements instead of bytes. I choose to crop the numpy array in bytes before reinterpreting it in dtype
.