Re: Getting true 32-bit integers with NSNumber?
Re: Getting true 32-bit integers with NSNumber?
- Subject: Re: Getting true 32-bit integers with NSNumber?
- From: Kyle Sluder <email@hidden>
- Date: Sun, 01 Dec 2013 22:37:42 -0800
On Sun, Dec 1, 2013, at 09:56 PM, Alex Hall wrote:
> Hello list,
> I was given a library someone made to use with OpenAL. When he made this,
> iOS2 was the standard, so naturally it is still 32-bit. I am now trying
> to use it on OS10, and am getting the expected implicit conversion
> errors. As far as I can tell, the numbers being used are all 64-bit
> integers, even when the library calls numberWithUnsignedInt.
It doesn't matter what method you use to create an NSNumber instance.
What matters is what method you use to get the primitive value back out.
-intValue and -longValue will give you an int (32 bits); -longLongValue
will give you a long long (64 bits); and -integerValue will give you an
NSUInteger (either 32 or 64 bits, depending on your target
platform—though nowadays you're almost certainly not targeting any
32-bit platforms).
> I cannot use ints or uints because this
> code relies heavily on an NSMutableDictionary, which cannot store
> primitive data types. Any ideas are appreciated. Thank you.
This is very concerning. I can't imagine it ever being a good idea to be
storing boxed numbers in an NSDictionary when doing anything
audio-related. What are you actually doing here?
--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