Simple get arch type

November 21, 2011 by · Leave a Comment 

#include <mach-o/arch.h>

+ (NSString *)getHostArchType
{
	const NXArchInfo *info = NXGetLocalArchInfo();
	
	switch (info->cputype) {
		case CPU_TYPE_POWERPC:
			return @"ppc";
			break;
		case CPU_TYPE_I386:
			return @"i386";
			break;
		case CPU_TYPE_POWERPC64:
			return @"ppc";
			break;
		case CPU_TYPE_X86_64:
			return @"i386";
			break;
		default:
			return @"na";
			break;
	}
}

About admin

Comments are closed.