Conversation
There was a problem hiding this comment.
Pull request overview
This PR makes the argsort function const-correct by updating its signature to accept const T* instead of T* for the input array parameter, addressing issue #223. Since argsort only reads from the input array to compute sorted indices (it doesn't modify the array), this change improves API clarity and prevents accidental modification of input data.
Changes:
- Updated argsort signature from
T*toconst T*across all public and internal APIs - Updated documentation in README.md to reflect the new const-correct signature
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/x86simdsort.h | Updated public API declaration of argsort to accept const T* |
| lib/x86simdsort.cpp | Updated DECLARE_INTERNAL_argsort macro to use const TYPE* for both function pointer and template implementation |
| lib/x86simdsort-skx.cpp | Updated SKX-specific argsort implementation to accept const type* |
| lib/x86simdsort-scalar.h | Updated scalar fallback implementation of argsort to accept const T* |
| lib/x86simdsort-internal.h | Updated internal API declaration of argsort to accept const T* |
| lib/x86simdsort-avx2.cpp | Updated AVX2-specific argsort implementation to accept const type* |
| README.md | Updated documentation example to show const T* in argsort signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @r-devulap , |
|
@AnkitAhlawat7742 lint failures. |
I’ll fix it right away. |
|
@r-devulap |
|
Hi @r-devulap , This commit normalizes line endings and applies clang-format to that file only, so that the repository now passes the CI formatting check cleanly. No functional or logic changes are introduced. |
|
@r-devulap — is it possible the CI is still running an older job? I verified the formatting locally on the current branch head using: The working tree is clean and the branch fix/argsort-const-correctness is fully in sync with origin. |
|
I am using: Ubuntu clang-format version 18.1.3 (1ubuntu1) anmd the command I use: |
Got it, thanks for pointing this out. The earlier failures were due to formatting differences between macOS clang-format (v21) and the CI environment. This should now pass the CI formatting step. |
Hey @r-devulap ,
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
r-devulap
left a comment
There was a problem hiding this comment.
LGTM. Do you want to update the argselect method as well? Might be good to complete that change in one patch.
Thanks @r-devulap |
Fix: #223
Summary
argsort does not modify the input array, but its public and internal APIs previously accepted a non-const pointer. This PR makes argsort const-correct by updating the function signatures to take a const T*, improving API clarity and preventing accidental modification of input data.
Changes
Updated argsort signatures to accept const T* instead of T*