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

Getting rid of int_pow. #16

wants to merge 3 commits into
base: master


None yet
1 participant

ChrisCalderon commented Nov 29, 2013

I was browsing the source when I noticed int_pow. First, I didn't like that it uses the simple linear algorithm. Second, it is only used twice, in the thread file, and for computing powers of two. Why write a function to multiply a number by 2, n time, in a loop, when you could do a simple bitshift and assignment?

ChrisCalderon added some commits Nov 29, 2013

Update thread.c
Replaced int_pow with bitshifts. It seemed unnecessary to use a function to compute powers of two, when a simple bitshift assignment would do. Tested the change on Mac OS X Snow Leopard with apple gcc-4.2, and I had no problems.
Update math.h
getting rid of unnecesary function.
Update math.c
getting rid of int_pow, unnecessary.

DonnchaC added a commit to DonnchaC/Shallot that referenced this pull request Dec 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment