Created
February 1, 2015 23:11
-
-
Save roothybrid7/3a225b5056b6bf806777 to your computer and use it in GitHub Desktop.
デバイスが32bitなのか64bitなのかチェックする ref: http://qiita.com/roothybrid7/items/3cfeb2837cb468bcab13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (sizeof(int *) == 4) { | |
// 32bit | |
} else if (sizeof(int *) == 8) { | |
// 64bit | |
} | |
// others |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UIDevice+Hardware.h | |
typedef NS_ENUM(NSUInteger, DeviceArchitecture) { | |
DeviceArchitectureUnknown, | |
DeviceArchitecture32Bit, | |
DeviceArchitecture64Bit, | |
}; | |
@interface UIDevice (Hardware) | |
- (DeviceArchitecture)cpuArchitecture; | |
@end | |
// UIDevice+Hardware.m | |
#import "UIDevice+Hardware.h" | |
@implementation UIDevice (Hardware) | |
- (DeviceArchitecture)cpuArchitecture { | |
if (sizeof(int *) == 4) { | |
return DeviceArhictecture32Bit; | |
} else if (sizeof(int *) == 8) { | |
return DeviceArchitecture64Bit; | |
} | |
return DeviceArchitectureUnknown; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment