Skip to content

Instantly share code, notes, and snippets.

@koke
Created May 24, 2012 22:47
Show Gist options
  • Save koke/2784685 to your computer and use it in GitHub Desktop.
Save koke/2784685 to your computer and use it in GitHub Desktop.
//
// NSNumberHelper.h
//
// Created by Jorge Bernal on 5/24/12.
// Copyright (c) 2012 Jorge Bernal. All rights reserved.
//
#define NSBool(scalar) [NSNumber numberWithBool:scalar]
#define CBool(object) [object boolValue]
#define NSChar(scalar) [NSNumber numberWithChar:scalar]
#define CChar(object) [object charValue]
#define NSDouble(scalar) [NSNumber numberWithDouble:scalar]
#define CDouble(object) [object doubleValue]
#define NSFloat(scalar) [NSNumber numberWithFloat:scalar]
#define CFloat(object) [object floatValue]
#define NSInt(scalar) [NSNumber numberWithInt:scalar]
#define CInt(object) [object intValue]
#define NSInteger(scalar) [NSNumber numberWithInteger:scalar]
#define CInteger(object) [object integerValue]
#define NSLong(scalar) [NSNumber numberWithLong:scalar]
#define CLong(object) [object longValue]
#define NSLongLong(scalar) [NSNumber numberWithLongLong:scalar]
#define CLongLong(object) [object longLongValue]
#define NSShort(scalar) [NSNumber numberWithShort:scalar]
#define CShort(object) [object shortValue]
#define NSUnsignedChar(scalar) [NSNumber numberWithUnsignedChar:scalar]
#define CUnsignedChar(object) [object unsignedCharValue]
#define NSUnsignedInt(scalar) [NSNumber numberWithUnsignedInt:scalar]
#define CUnsignedInt(object) [object unsignedIntValue]
#define NSUnsignedInteger(scalar) [NSNumber numberWithUnsignedInteger:scalar]
#define CUnsignedInteger(object) [object unsignedIntegerValue]
#define NSUnsignedLong(scalar) [NSNumber numberWithUnsignedLong:scalar]
#define CUnsignedLong(object) [object unsignedLongValue]
#define NSUnsignedLongLong(scalar) [NSNumber numberWithUnsignedLongLong:scalar]
#define CUnsignedLongLong(object) [object unsignedLongLongValue]
#define NSUnsignedShort(scalar) [NSNumber numberWithUnsignedShort:scalar]
#define CUnsignedShort(object) [object unsignedShortValue]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment