12-22-07 12:22 AM
Aditya <adityagupta.18@gmail.com> wrote:
> So, please help me out with a common solution(may be a shell script),
> which tells me that my OS is 32-bit or 64-bit.
To do this programmatically, (not from a shell script):
Define an integer of value 4294967295 then compare it to an unsigned
value of -1. If it matches, then the platform is 32 bit.
A 64 bit platform would not cause a match here, because the minus bit
would be stored in the more significant doubleword.
Note I hope that my "twos compliment" maths is right. (I pulled these
numbers from out of my head, so I haven't actually done any calculations
here). If I am wrong, then I am sure that someone will follow up with
corrected values.
Mark.
--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE
Email: markhobley at hotpop dot donottypethisbit com
http://markhobley.yi.org/
[ Post a follow-up to this message ]
|