Skip to content

Refactor: reduce redundant code in NumericSort.Compare() #1417

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

goran-w
Copy link
Contributor

@goran-w goran-w commented Jun 13, 2025

  • Refactor the 2 do-loops into simpler while-loops and replace the use of "tmp1/2" char-arrays with calls to String.Substring().
  • Rename the "loc1/2" variables to "subLen1/2", for clarity, since they represent the lengths of the two extracted Substrings.

These changes make the logic more compact and easier to follow.

Loosely related to issues #597, #1413 and PR #1401 (where an earlier try at this refacoring was included but not merged).

* Refactor the 2 do-loops into simpler while-loops and replace the use of "tmp1/2" char-arrays with calls to String.Substring().
* Rename the "loc1/2" variables to "subLen1/2", for clarity, since they represent the lengths of the two extracted Substrings.

These changes make the logic more compact and easier to follow.
@goran-w goran-w force-pushed the refactor_numeric_sort branch from b2ae647 to 72a748f Compare June 13, 2025 08:52
@love-linger love-linger self-assigned this Jun 13, 2025
@love-linger love-linger added the code-style Code style label Jun 13, 2025
@love-linger love-linger merged commit 8dffdef into sourcegit-scm:develop Jun 13, 2025
13 checks passed
love-linger added a commit that referenced this pull request Jun 13, 2025
Remove unnecessary namespace using

Signed-off-by: leo <longshuang@msn.cn>
@goran-w goran-w deleted the refactor_numeric_sort branch June 13, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-style Code style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants