• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unsigned Long Long
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Unsigned Long Long (From: email@hidden)
 >Re: Unsigned Long Long (From: Fritz Anderson <email@hidden>)
 >Re: Unsigned Long Long (From: Sherm Pendley <email@hidden>)
 >Re: Unsigned Long Long (From: Clark Cox <email@hidden>)
 >Re: Unsigned Long Long (From: Sherm Pendley <email@hidden>)
 >Re: Unsigned Long Long (From: Clark Cox <email@hidden>)
 >Re: Unsigned Long Long (From: Sherm Pendley <email@hidden>)
 >Re: Unsigned Long Long (From: Marcel Weiher <email@hidden>)

  • Prev by Date: Re: Cocoa Programming for Mac OS X (SE)
  • Next by Date: [list mom] - Re: [ANN] Searchable Cocoa-Dev Web Archive
  • Previous by thread: Re: Unsigned Long Long
  • Next by thread: Re: Unsigned Long Long
  • Index(es):
    • Date
    • Thread