You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a 32-bit integer for indexing, the data array in the C code has size n_points * n_dim and is indexed using a 32bit int type (see e.g. the PA macro).
Currently the condition to use a 32-bit int is that n_points < UINT_MAX, but then the above can overflow.
The correct condition should instead be n_points * n_dim < UINT_MAX
The text was updated successfully, but these errors were encountered:
lkeegan
added a commit
to lkeegan/pykdtree
that referenced
this issue
Jan 29, 2025
- correct the condition for using 32bit int indices
- previous condition: `n_points < UINT_MAX`
- however the data array in the C code has size `n_points * n_dim` and is indexed using a 32bit int type (see e.g. the PA macro)
- this means results were incorrect for the case where `n_points < UINT_MAX` and `n_points * n_dim >= UINT_MAX`
- new condition: `n_points * n_dim < UINT_MAX`
- resolvesstorpipfugl#138
- render mako template
- the generated _kdtree_core.c did not contain latest changes from _kdtree_core.c.mako (sorry my mistake)
- this meant results were incorrect for the case `n_points < UINT_MAX` and `n_query * k >= UINT_MAX`
- resolvesstorpipfugl#137
- use signed 64bit ints for the OpenMP loop on all platforms
- to support OpenMP versions < 3 which only allow signed integers as loop counters
When using a 32-bit integer for indexing, the data array in the C code has size
n_points * n_dim
and is indexed using a 32bit int type (see e.g. the PA macro).Currently the condition to use a 32-bit int is that
n_points < UINT_MAX
, but then the above can overflow.The correct condition should instead be
n_points * n_dim < UINT_MAX
The text was updated successfully, but these errors were encountered: