Platforms to show: All Mac Windows Linux Cross-Platform

FAQ.How can I detect whether an Intel CPU is a 64bit CPU?

Answer: Look on the CPU family returned by sysctl:
Example
Function is64bit() As Boolean

#if TargetLittleEndian

dim m as MemoryBlock = NewMemoryBlock(8)
dim family as Integer
dim s as string

m=SystemControlNameToMIBMBS("hw.cpufamily")
m=SystemControlMBS(m)

if m<>nil then
m.LittleEndian=True
family=m.Long(0)

const CPUFAMILY_INTEL_6_14 = &h73d67300 //* "Intel Core Solo" and "Intel Core Duo" (32-bit Pentium-M with SSE3) */
const CPUFAMILY_INTEL_6_15 = &h426f69ef //* "Intel Core 2 Duo" */
const CPUFAMILY_INTEL_6_23 = &h78ea4fbc //* Penryn */
const CPUFAMILY_INTEL_6_26 = &h6b5a4cd2 //* Nehalem */

Select case family
case CPUFAMILY_INTEL_6_14
Return false
case CPUFAMILY_INTEL_6_15
Return true
case CPUFAMILY_INTEL_6_23
Return true
case CPUFAMILY_INTEL_6_26
Return true
// newer CPUs may be missing here
end Select

end if

#endif

Return false

Exception
Return false
End Function

This code is written for Mac OS X where you only have a limited number of possible CPUs.


The biggest plugin in space...