Jump to content
The simFlight Network Forums

Bytes & Offsets


flatdog
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.