Skip to content
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

Fix unnecessary modulo operations in Index1D.h #1927

Closed
wants to merge 1 commit into from

Conversation

NaNExist
Copy link

@NaNExist NaNExist commented Nov 6, 2024

Description

This PR replaces unnecessary modulo operations with multiplication and subtraction.

Motivation and context

I was browsing through the project code and realised that this was a change that would improve performance.

How has this been tested?

Local compilation passes fine.

Change log

* Fix unnecessary modulo operations in Index1D.h

Checklist:

Replacing unnecessary modulo operations with multiplication and subtraction
@joaander
Copy link
Member

joaander commented Nov 6, 2024

Thanks, I appreciate the effort. However, getPair() is dead code. It is called by only one code path that has not bee used for many years. I plan to remove it in the next release (#1664):

uint2 p = cli.getPair(idx);

@NaNExist NaNExist closed this Nov 6, 2024
@NaNExist NaNExist deleted the trunk-patch branch November 6, 2024 14:56
@joaander
Copy link
Member

#1936 removes the code that unnecessarily invokes the modulus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants