• 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: Getting true 32-bit integers with NSNumber?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting true 32-bit integers with NSNumber?


  • Subject: Re: Getting true 32-bit integers with NSNumber?
  • From: Kyle Sluder <email@hidden>
  • Date: Mon, 02 Dec 2013 02:34:29 -0800

On Dec 2, 2013, at 2:27 AM, Kyle Sluder <email@hidden> wrote:

>> On Dec 2, 2013, at 1:54 AM, ChanMaxthon <email@hidden> wrote:
>>
>> You can check what type int32_t (or uint32_t) is typedef'd to and use that corresponding type on your intended platform. Sort of like:
>>
>> - (int32_t) int32Value
>> {
>>   if (!strcmp(@encode(int32_t), @encode(int))
>>       return [self intValue];
>>   else if (!strcmp(@encode(int32_t), @encode(long))
>>       return [self longValue];
>>   else
>>       return 0;
>> }
>
> This code is useless on iOS and OS X, as they are LP64 platforms. `int` and `long` are always 32 bits.

Ok, this has to rank up there with the stupidest things I've ever said on this list. The very meaning of “LP64” is that longs are 64 bits wide.

The code is still unnecessary. If you want a 32-bit value, use -intValue. No need to compare @encode strings.

It’s 2:30am, and I should really go to bed. Sorry for the noise.

--Kyle Sluder

_______________________________________________

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


References: 
 >Getting true 32-bit integers with NSNumber? (From: Alex Hall <email@hidden>)
 >Re: Getting true 32-bit integers with NSNumber? (From: Kyle Sluder <email@hidden>)
 >Re: Getting true 32-bit integers with NSNumber? (From: ChanMaxthon <email@hidden>)
 >Re: Getting true 32-bit integers with NSNumber? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Getting true 32-bit integers with NSNumber?
  • Next by Date: Re: Getting true 32-bit integers with NSNumber?
  • Previous by thread: Re: Getting true 32-bit integers with NSNumber?
  • Next by thread: Re: Getting true 32-bit integers with NSNumber?
  • Index(es):
    • Date
    • Thread