-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Structured dtype cleanup #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This includes preserving the 'align=True' parameter through the new NPY_ALIGNED_STRUCT dtype flag. The code now detects whether the list version of structured dtype construction would match the data layout, to choose between list and struct based construction.
The 'struct'-based repr adds this parameter, as the general way to be able to reconstruct the dtype.
numpy#1790) In the case referenced in ticket numpy#1790, the itemsize was set before the padded size was calculated, so the intent was clearly that it should have been aligned.
This will require validation that object dtypes don't overlap with other fields in a follow-on commit.
/* The alignment is always a power of 2, so this works */ | ||
totalsize = (totalsize + maxalign - 1) & (-maxalign); | ||
} | ||
|
||
new = PyArray_DescrNewFromType(PyArray_VOID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filler ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is specifically the bugfix for #1790. That code (well, functionally equivalent code) was already there, just after assigning totalsize to new->elsize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the filler is gone, you just provide enough aligned space for the item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there never was any filler, just the illusion of filler created during the repr call.
Looks good as far as I am able to judge. |
I've added some more commits:
|
feat: Add vshl_n_s8
This set of patches cleans up structured dtypes. In particular: