Re: Assemblers are for hiding your work , not for faster code .




John Larkin wrote:

On Fri, 12 Jan 2007 12:46:57 +0000, John Devereux
<jdREMOVE@xxxxxxxxxxxxxxxxxx> wrote:

John Larkin <jjlarkin@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

The point is not to be fast, but to be right.

<SNIP>

OK, show us some code.

unsigned long long a;

.
.
.
.

a /= 10;

And yes, all good people hate C.

:)

How many bytes does that compile to? What's the execution time? How
many bits in a "long long"?

With a good compiler, and CPU that supports 64 bit, the 'a /= 10' could
be translated to a few inline instructions, similar to your hand
written assembly. Some compilers recognize the divide by 10 as a
special case, others may recognize divide by any constant. If the CPU
doesn't natively support 64 bit types, it will most likely be compiled
as a function call.

.



Relevant Pages