Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Burty

Little endian function?

This topic is 5366 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How would you write a function will return true for systems which use a little-endian byte ordering, and false for systems which use a big-endian byte ordering. I am doing a test but not doing great so any help would be appreciated. Thanks B

Share this post


Link to post
Share on other sites
Advertisement
Why do you want to do this? If you program whatever it is you''re doing properly, it shouldn''t matter.
Anyway, it should be fairly trivial. A byte can contain up to 255, so anything over 255 will go into 2 bytes. So, 256 will have 1 in the high byte, and 0 in the low byte. Then you find out what byte is the high byte, and you can get the answer to your question from that.

Share this post


Link to post
Share on other sites
All you need to do is think about when it would matter which endian format you were using. Once you know that a check for it should be easy.

Share this post


Link to post
Share on other sites
So you are asking us to help you cheat on your test?

Don''t you realize that although you won''t look as good because you can''t answer the question, you will look very bad when they discover that you cheated on the test?

In a phone interview recently, a candidate was asked about dot products. He said he was very familiar with that, but needed a few seconds to remember the details. In the few seconds that it took him to "remember", lots of typing could be heard. After a few seconds of typing, he responded with an answer that was obviously quoted from a reference that he just read. The interview ended quickly.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

So you are asking us to help you cheat on your test?



There is no way you can be sure of that.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
quote:

So you are asking us to help you cheat on your test?



There is no way you can be sure of that.


Which might be the reason for the question mark at the end of his _question_ ?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!