• 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: Clark Cox <email@hidden>
  • Date: Thu, 13 May 2004 08:31:16 -0400

On May 12, 2004, at 23:00, Sherm Pendley wrote:

> On May 12, 2004, at 10:05 PM, Clark Cox wrote:
>
>> On May 12, 2004, at 21:15, Sherm Pendley wrote:
>>
>>> Bit-shifting is faster than division:
>>
>> ...but then you make a statement that is also not supported by the
>> standard.
>
> I didn't say it was. Nor did I state or imply that it should it be -
> it's an implementation detail, not part of the language definition.
>
> Regardless, any introductory programming text or class will tell you
> the same thing. If you're multiplying or dividing by a power of two,
> bit-shifting is always faster than integer division.

"always" is a dangerous word...

>>> Assuming of course that GCC doesn't optimize division by a constant
>>> power of 2 into a bit-shift on its own.
>>
>> That is a bad assumption to make, for something so easily testable,
>> there is no need to assume.
>
> What are you suggesting, that I benchmark the bit-shift operators
> and/or examine the assembly code produced by every compiler available?

No, I'm suggesting that you test the assumption that "GCC doesn't
optimize division by a constant power of 2 into a bit-shift on its own"

> Is that your idea of "easily testable?" Why would I go to such absurd
> lengths, when there's a trivially simple alternative that's guaranteed
> to produce optimal code with any C compiler for any modern CPU?

--
Clark S. Cox III
email@hidden
http://homepage.mac.com/clarkcox3/
http://homepage.mac.com/clarkcox3/blog/B1196589870/index.html

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


  • Follow-Ups:
    • Re: Unsigned Long Long
      • From: Sherm Pendley <email@hidden>
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>)

  • Prev by Date: Re: Flash animation
  • Next by Date: Re: Array operators (was: Custom canRemove binding)
  • Previous by thread: Re: Unsigned Long Long
  • Next by thread: Re: Unsigned Long Long
  • Index(es):
    • Date
    • Thread