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;
}

Sent from my iPhone

> On 2013年12月2日, at 14:37, Kyle Sluder <k...@ksluder.com> wrote:
> 
>> 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 (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/xcvista%40me.com
> 
> This email sent to xcvi...@me.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to