判断操作系统是 32bit 的还是 64bit的。
uname –a # Output: Linux pvxeon015 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:46:26 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
判断 CPU 是32bit的还是64bit的。
grep flags /proc/cpuinfo ## lm = Long mode - 64 bit CPU ##
Note: 64bit cpu can run a 32bit OS (64bit的cpu是可以安装32bit的操作系统的)
判断一个二进制可执行文件是32bit的还是64bit的。
file /depot/coreutils-5.2.1/bin/ls # Output: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5 …
在64bit的环境下编译32bit的程序。
g++ -m32 ….
AMD64 和 Intel-64有什么分别呢?
Yes. There are Intel-64 implementation. http://en.wikipedia.org/wiki/X86-64
But AMD implement the 64bit architecture first, and Intel-64 is comparable with AMD-64, so people use AMD64 for x86-64.