• 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: NSInteger/NSUInteger Considerations (64 bit)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInteger/NSUInteger Considerations (64 bit)


  • Subject: Re: NSInteger/NSUInteger Considerations (64 bit)
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 27 Mar 2014 18:02:35 -0700

On Mar 27, 2014, at 3:34 PM, Roland King <email@hidden> wrote:

> no difference, NSInteger, NSUInteger are just typedefs for underlying integral types

On 32-bit iOS, int and NSInteger are both 32-bit, so there’s no difference.
On Mac OS (and 64-bit iOS), int is 32-bit but NSInteger is 64-bit. I don’t actually know whether there’s any performance difference between 32- and 64-bit math on 64-bit processors, but you can’t just hand-wave the question away.

What _is_ different is that 64-bit numbers occupy twice as much space in the CPU caches, so only half as many will fit. Cache misses are orders of magnitude more expensive than integer math operations, so that’s the more significant issue.

—Jens

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSInteger/NSUInteger Considerations (64 bit)
      • From: Dave <email@hidden>
References: 
 >NSInteger/NSUInteger Considerations (64 bit) (From: Dave <email@hidden>)
 >Re: NSInteger/NSUInteger Considerations (64 bit) (From: Jens Alfke <email@hidden>)
 >Re: NSInteger/NSUInteger Considerations (64 bit) (From: Chris Hanson <email@hidden>)
 >Re: NSInteger/NSUInteger Considerations (64 bit) (From: Dave <email@hidden>)
 >Re: NSInteger/NSUInteger Considerations (64 bit) (From: Roland King <email@hidden>)

  • Prev by Date: Re: SplitView autolayout + autosave = proportionally resized views
  • Next by Date: IKSaveOptions have trouble on Mavericks
  • Previous by thread: Re: NSInteger/NSUInteger Considerations (64 bit)
  • Next by thread: Re: NSInteger/NSUInteger Considerations (64 bit)
  • Index(es):
    • Date
    • Thread