How to check if the OS is 64 Bit?

Hi,

is there a simple way to check if the OS is 64 Bit or not. I dont`t want to know if the programm runs as 64 Bit. So I like to know regardless of the builded executeable (32 Bit / 64 Bit) if the OS itself could handle 64 Bit.

For .Net there seems to be a System Property called Environment.Is64BitOperating.
https://docs.microsoft.com/en-us/dotnet/api/system.environment.is64bitoperatingsystem?view=netcore-3.1

Is there something similar in Rust?

https://crates.io/crates/bitness

2 Likes

Wow that was fast. Thanks

1 Like

Note, that relies on the uname machine, which can be faked with setarch.

1 Like

Yes, by changing your bitness you can fool the bitness module into reading your machine's bitness.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.