how to improve - HCF

Pages: 12
I did not suggest to use abs because I do not like to call a function (moreover two times) for such simple operations.

As for the replacement whether for example 10 % 6 is the same as 6 % 10?
6%10 = 6
In the next iteration you will compute 10%6

I do not like to call a function (moreover two times) for such simple operations.
There is no big overload. If that's an issue you could inline the call.
¿What do you think that functions are for?
Last edited on
Also, note that some compilers supply intrinsics for small, common operations. abs() is one of the functions which Visual C++ treats in this way.
http://msdn.microsoft.com/en-US/library/5704bbxw%28v=vs.80%29

Compiler Intrinsics
http://msdn.microsoft.com/en-us/library/26td21ds%28v=vs.80%29

Most functions are contained in libraries, but some functions are built in (that is, intrinsic) to the compiler. These are referred to as intrinsic functions or intrinsics.
Last edited on
Topic archived. No new replies allowed.
Pages: 12