Test your CPU for 32 or 64 bits with gcc

Here’s an easy way to tell if your processor is 32 or 64 bits.  The __WORDSIZE def in glibc is either 32 or 64 bits, and here’s how you check it:

You can just type ‘make’ and then run the test program that is generated.  Here is a zip file with the code above and a Makefile: cpu-test

If you don’t want to use the Makefile, just do:

make && ./test



[mike.baranski@switters cpu-test]$ ls
Makefile test.c
[mike.baranski@switters cpu-test]$ make
gcc -o test test.c
[mike.baranski@switters cpu-test]$ ./test
[mike.baranski@switters cpu-test]$

Leave a Reply

Your email address will not be published. Required fields are marked *