Re: common solution for Linux, Solaris, HP-UX and AIX to get whether ?system is 32 bit
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: common solution for Linux, Solaris, HP-UX and AIX to get whether ?system is 32 bit




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: common solution for Linux, Solaris, HP-UX and AIX to get whether ?system is 32 bit  
Mark Hobley


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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 ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:28 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register