From 918217f6d21d2b9043fb84519e7cc06d3c657eaa Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 4 Jul 2008 16:22:06 -0700 Subject: [PATCH] Detect 64 bit support and a) report that, b) use it to tell Core 2 from Core --- SUSystemProfiler.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SUSystemProfiler.m b/SUSystemProfiler.m index c4e715f0..af60baeb 100644 --- a/SUSystemProfiler.m +++ b/SUSystemProfiler.m @@ -56,12 +56,24 @@ } [profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cputype",@"CPU Type", [NSNumber numberWithInt:value], visibleCPUType,nil] forKeys:profileDictKeys]]; } + error = sysctlbyname("hw.cpu64bit_capable", &value, &length, NULL, 0); + if(error != 0) + error = sysctlbyname("hw.optional.x86_64", &value, &length, NULL, 0); //x86 specific + if(error != 0) + error = sysctlbyname("hw.optional.64bitops", &value, &length, NULL, 0); //PPC specific + + BOOL is64bit = NO; + + if (error == 0) { + is64bit = value == 1; + [profileArray addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"cpu64bit", @"CPU is 64 bit", [NSNumber numberWithBool:is64bit], is64bit ? @"Yes" : @"No", nil] forKeys:profileDictKeys]]; + } error = sysctlbyname("hw.cpusubtype", &value, &length, NULL, 0); if (error == 0) { NSString *visibleCPUSubType; if (cpuType == 7) { // Intel - visibleCPUSubType = @"Intel"; // If anyone knows how to tell a Core Duo from a Core Solo, please email tph@atomicbird.com + visibleCPUSubType = is64bit ? @"Intel Core 2" : @"Intel Core"; // If anyone knows how to tell a Core Duo from a Core Solo, please email tph@atomicbird.com } else if (cpuType == 18) { // PowerPC switch(value) {