Hi,

I'm running into problems with [NSNumber numberWithUnsignedShort: 0x8000].

The following app returns the expected values when compiled against the Leopard SDK.
  Compiled against the 10.4 SDK, I get:
NSNumberTest[6058:813] 8000 (expected:8000) ffff8000 (expected:8000) -32768 (expected:32768)

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    // insert code here...
        NSNumber *aNumber = [NSNumber numberWithUnsignedShort:0x8000];
        NSLog(@"%x (expected:8000) %x (expected:8000) %@ (expected:32768)",
                [aNumber unsignedShortValue],
                [aNumber intValue],
                [aNumber description]);
    [pool drain];
    return 0;
}

What are my best options to get around that? (Except of using the next larger NSNumber variants to store unsigned values in order to prevent unwanted sign expensions for unsigned values)?

TIA,
        Tom_E

_______________________________________________

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

This email sent to [EMAIL PROTECTED]

Reply via email to