Re: NSInteger/NSUInteger Considerations (64 bit)
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