Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I have read the post explaining bits, numbers and hexadecimal and have a (very) basic question. If you take the offset for Autopilot altitude lock (07D0) it is documented as 4 bytes (and is therefore a DWORD?). As far as I can gather the offset on holds two values: 0 for off and 1 for on so why does it need 4 bytes or 32 bits to accomplish this. A link to further reading on this subject would be most welcome.

Thank you,

Philip

Posted
I have read the post explaining bits, numbers and hexadecimal and have a (very) basic question. If you take the offset for Autopilot altitude lock (07D0) it is documented as 4 bytes (and is therefore a DWORD?). As far as I can gather the offset on holds two values: 0 for off and 1 for on so why does it need 4 bytes or 32 bits to accomplish this.

It doesn't. A single byte or even a single bit in a byte (along with 7 other switches) would have been more economical on space. But evidently Microsoft felt they had no need to be economical. It is probably a bit faster too to have everything in 32-bit variables when using a 32-bit machine. Also, if you are lazy when writing code in C or C++ (or most others too), then by default variables will take up the word-size specific to the compiler and target machine -- 32-bit compilers will compile "BOOL" (a boolean value, TRUE or FALSE, 1 or 0) into a 32-bit value and 64-bit compilers will use a 64-bit ("QWORD" or quad-word) value.

Regards

Pete

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.