Which platforms are big endian




















Careers Careers. Learn about game development. Follow Us. Chat in the GameDev. Back to Networking and Multiplayer. Networking and Multiplayer Programming. Started by lride March 02, PM. Trying to see if there is a point in trying to write endian independent code. Cancel Save. This is one of those "If you have to ask, the answer is no" questions.

When is the answer is "Yes"? So unless you have a specific reason to support big-endian format, don't. SeanMiddleditch I'd additionally add that even if you are going to support big-endian systems for some reason, optimize for the common case.

Ravyne You can use a little code to test which endian it is in your platform. You're more likely to run into trouble with different compilers using different padding rules, and perhaps different CPUs using slightly varying floating point rules 80 bit extended, anyone?

That other good news is that, if in the future you were suddenly to have to port to a big-endian system, it's not the end of the world. Check where you call send and recv. Trace your code backwards from there, to where the data is put in. Call the appropriate swap macro at that point. A bit tedious work, but not hard. And very unlikely you actually have to do it. Sergey Ignatchenko Trying to see if there is a point in trying to write endian independent code At this point and for games, probably there is little point to write endian-independent stuff though you never know what those-guys-with-consoles-will-come-up-with.

This topic is closed to new replies. Your addendum is not entirely true and neither do I agree with zxcdw : endianness matters only when translating between multibyte integers and byte streams, and becomes a problem when it's done implicitly and varies between platforms. Most modern languages whether VM-based or not achieve portability by having you do it rarely with integers as an opaque datatype , and then have endianness either specified independant of platform, or explicitly chosen by the programmer.

MichaelBorgwardt ARM does arium. Constants, for example, don't need to be specified a byte at a time. Show 9 more comments. Andrew Wagner Andrew Wagner 1 1 silver badge 3 3 bronze badges. The receiving end then parses the formatting to get the integer text and converts it back into 4 bytes. This is called progress, I'm told :- — gbjbaanb. Endians only really matters when you are transferring binary data systems. Martin York Martin York 11k 2 2 gold badges 39 39 silver badges 70 70 bronze badges.

My students have also developed for mobile phones and used cloud computing, so they know the world is not PCs and Macs. Loki - it's possible to serialize and de-serialize without knowing the endian of the machine. I've designed binary file formats without knowing the machines that the software would run on - I basically chose an endian ordering for the file format without caring about the hardware.

Steve Yes of course you can. When you are working on the "Binary Data Layer" you can devise whatever scheme you want to serialize your data and it is not hard to devise schemes that that are portably. Though personally I would not bother to re-invent a wheel that has been built and well tested since the 60's. But: Most inter-computer communication is carried out using protocols that specify big-endian order A very large proportion of the world's software runs on a virtual platform that defaults to big-endian order whenever data is written to external storage.

Both orders are going to be with us for the foreseeable future. Jules Jules The majority of the largest systems i. That is, so-called mini or mainframe systems which make up a huge amount of the backend processing most of us don't care about.

I don't think anyone can make any strong assertions that endianness is anything more than convenience on the part of the architecture designers for whatever they want to achieve. At the time I made that ancient comment, big iron was BE.

But this is not because it is BE, but because the architecture happens to be that way. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. An important distinction to make about endianness is that it only refers to how values are stored in memory and not how we deal with values; for example, 0x is still 0x There is no concept of endianness here. However, if we were talking about storing this 4-byte value into memory, then and only then would we have to specify endianness.

If we were to store the previously mentioned value into memory using little-endian we would get the following. Note that each 2 hex letters represent 1 byte. In the end, that is why endianness is important; because not knowing how data is stored would lead to communicating different values.

This means that in order for you to use the Internet, your computer has to account for the difference in endianness. As a reminder, little-endianness refers to the byte ordering where the least significant byte is stored first. So for example, if we have the 8-byte value of 0xabcdef0 we would store it in memory in the following way. Note: I put a pseudo memory address next to the values, this is so we can say that this value is at memory address 0x The most important thing to understand here is that we are storing an 8-byte value.

On the other hand, if we were storing a 4-byte value, we would still flip the byte order, but just for those 4 bytes. Take the following array as an example. This array, like the 8-byte number, takes up 8 total bytes and looks very similar.

However, in memory, we would not store the same thing as above, but instead the following:. Notice here how the order of the array is preserved and that the 0x value individually the first 4 bytes is in little-endian.

Now, if we bring this back to big-endian, we can see that every one of these examples is stored in the same way. This is because big-endian is stored in the order that you see things.



0コメント

  • 1000 / 1000