Re: Unsigned Long Long
Re: Unsigned Long Long
- Subject: Re: Unsigned Long Long
- From: John Stiles <email@hidden>
- Date: Thu, 13 May 2004 13:25:41 -0700
On May 13, 2004, at 11:14 AM, Marcel Weiher wrote:
"always" is a dangerous word...
Yep - it's not a word I like to use. I'm just repeating what every
text book, paper, tutorial, etc., has told me. And experience has
borne it out - every CPU I'm aware of has hardware bit-shifting
instructions that are substantially faster than its integer divide
instructions, which are generally implemented in microcode.
That used to be true of multiply as well, now we've got CPUs with
single-cycle floating point multiply-add instructions. I am not
making a prediction that the same will happen with divide, but things
change.
Hardware floating point multiply is *easy*. Really easy. Easier than
addition, in fact. Division (well, reciprocal calculation in
particular) has always been a much tougher nut to crack.
I don't know why this thread has gone on so long, though. Considering
that getting a file's attributes from the hard disk will take literally
millions of times longer to execute than a division operation, you will
NEVER feel any difference between division and bit shifting in your
code. Plus, modern optimizing compilers can all do something called
"strength reduction," which is a fancy way of saying that it will
automatically convert expensive operations (like our division by a
power of two) into cheaper but equivalent operations (like our bit
shift).
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.