Skip to content

Divisions turned into multiplications #42

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
Oct 13, 2015
Merged

Conversation

jmdana
Copy link
Contributor

@jmdana jmdana commented Oct 6, 2015

As correctly stated by @Mausy5043, the division is quite slow in most
microcontrollers, so I have replaced them with multiplications.

As correctly stated by Mausy5043, the division is quite slow in most
microcontrollers, so I have replaced them with multiplications.
@tdicola tdicola merged commit 5bc0a5c into adafruit:master Oct 13, 2015
@tdicola
Copy link
Contributor

tdicola commented Oct 13, 2015

Thanks for submitting the change! Gave it a quick test and it looks great. I didn't check the speed, but can see how it might be a teeny bit faster. One thing though I switched the array indexing back to integer division by 8 since we don't really want a floating point value there (and the compiler is probably optimizing it into a couple bit shifts anyways). Thanks again for contributing!

@jmdana
Copy link
Contributor Author

jmdana commented Oct 13, 2015

I can't believe that I made such a mistake with the array index. Thanks for fixing it!

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