• 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: Why is UInt32 << 32 a no-op?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is UInt32 << 32 a no-op?


  • Subject: Re: Why is UInt32 << 32 a no-op?
  • From: "Eric A. Borisch" <email@hidden>
  • Date: Tue, 17 Nov 2009 20:09:21 -0600

I was thinking of the situation presented with a 32 bit data value; presumably there would be logic elsewhere to keep the shift value <=32 (64, really)

Any solution will have its own set of caveats; this addresses enabling a 32 bit shift on a 32 bit data value without extra processing (branching) overhead...

On Tue, Nov 17, 2009 at 1:50 PM, Alastair Houghton <email@hidden> wrote:
On 17 Nov 2009, at 18:49, Eric A. Borisch wrote:

> If you're on a 64-bit platform, this shouldn't have much (if any) of a
> performance hit:
>
> n = (UInt64) n << shift

Though it will still be undefined if shift happens to go higher than 64.

That might seem obvious, but consider the case where shift is calculated somehow; it's pretty easy to end up with it largely unbounded if you aren't careful.

Kind regards,

Alastair.

--
http://alastairs-place.net






--
Eric A. Borisch
email@hidden

Howard Roark laughed.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Why is UInt32 << 32 a no-op? (From: Jens Alfke <email@hidden>)
 >Re: Why is UInt32 << 32 a no-op? (From: "Eric A. Borisch" <email@hidden>)
 >Re: Why is UInt32 << 32 a no-op? (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Conditional Build Setting issue
  • Next by Date: Re: How to specify that files of a particular type should be recognized as source code?
  • Previous by thread: Re: Why is UInt32 << 32 a no-op?
  • Next by thread: Conditional Build Setting issue
  • Index(es):
    • Date
    • Thread