Windows endianity


















Any more feedback? The more you tell us the more we can help. Can you help us improve? Resolved my issue. Clear instructions. Easy to follow. No jargon. Pictures helped. Didn't match my screen. Incorrect instructions. Too technical. Not enough information. Original response: As far as I'm aware there are no desktop or server versions of windows that support big-endian.

NtscCobalt NtscCobalt 1, 1 1 gold badge 14 14 silver badges 30 30 bronze badges. I suspect that that code fragment reflects the endianness of the compiler rather than the target architecture which will be a problem when doing any kind of cross compiling - especially a problem when developing applications for smart phones — Chris Becke.

Anyway there is a pretty detailed post about detection of endian in c that doesn't rely on preprocessor tricks here stackoverflow. I'm pretty sure that PPC is always big endian. Runtime checks that depend on unions or pointer casts taking the LSB out of a word and seeing if it's the first or last byte work properly.

Compile-time checks mostly seem to involve checking the architecture being compiled for by way of a preprocessor definition at least, that seems to be how boost does it. Show 2 more comments. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.

The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. The standard way is to use a union. Improve this answer.

Community Bot 1. Apprentice Queue Apprentice Queue 2 2 silver badges 4 4 bronze badges. However, Windows will probably only ever run in little-endian mode. After setting the data for one member, then trying to access the other, I'll get errors that prevent the code from compiling. I figured the current method would be a safe bet, but completely overlooked how the data would be accessed through an array.

The problem is that using behavior defined by the standard seems to limit how byte-level data can be access during compilation. Neither casting to another data type or bit-leven operations seem to work. But many compilers allow it. Show 1 more comment. I tried another solution though end edited it into the original question.

Though I have to admit, I'm not really sure how it is applied into a constexpr during compile-time. As for the switch statement, one of the restrictions for a constexpr statement is that the body of the function can only consist of a single return statement.

In this case the switch can be converted to a simple series of ternary operators. The value variable is meant to be used only in the first option suggested. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.

Post as a guest Name.



0コメント

  • 1000 / 1000