Changes

Jump to: navigation, search

Endianness

323 bytes added, 20:34, 26 April 2019
no edit summary
=Digits in Numbers=
With endianness, we have to consider how we usually write text (letters of a word, word of a sentence) and numbers (left to right LTR, right to left RTL, top to bottom TTB, bottom to top BTT). Assuming [https://en.wikipedia.org/wiki/Bi-directional_text textflow] is from left-to-right (LTR) and [https://en.wikipedia.org/wiki/Hindu-Arabic_numeral_system Hindu-Arabic numeral system], we write numbers (decimal, as well as binary, octal and hexadecimal) [[Big-Endianendian|big-endian]] wise ("big end first") - that is, we write (or transmit) from most significant to least significant digit from left (first) to right (last).
=Numbers in Dates=
With respect to the significance of the sub-items, we would use big-endian as well, the biggest item left (first), thus yyyy-mm-dd. Anyway, [https://en.wikipedia.org/wiki/Calendar_date Calendar dates] are written quite differently in various countries and cultures, also with various separators.
* [[Little-Endianendian]], dd-mm-yyyy common to the vast majority of the world's countries* Middle-Endian endian mm-dd-yyyy as used in the [https://en.wikipedia.org/wiki/Calendar_date#mm.2Fdd.2Fyy_or_mm.2Fdd.2Fyyyy_.28month.2C_day.2C_year.29 United States] and a few other [https://en.wikipedia.org/wiki/Calendar_date#mm.2Fdd.2Fyy_or_mm.2Fdd.2Fyyyy_.28month.2C_day.2C_year.29 countries], likely more desciptive with name of the month.* [[Big-Endianendian]] yyyy-mm-dd as defined by [https://en.wikipedia.org/wiki/ISO_8601 ISO 8601]
One of the advantages of using the ISO 8601 big-endian standard date format is that when dates in this format are ordered by a standard [https://en.wikipedia.org/wiki/Collation collation] by leading characters first, they are also in date order.
Still other architectures, generically called middle-endian or mixed-endian, may have a more complicated ordering; [[PDP-11]], for instance, stored some 32-bit words, counting from the most significant, as: 2nd byte first, then 1st, then 4th, and finally 3rd.
As a useful side-effect for computerchess from that war of endianness <ref>[httphttps://www.ietf.org/rfc/ien/ien137.txt IEN 137 - DAV's Endian FAQ - On Holy Wars and a Plea for Peace] by [httphttps://wwwen.myriwikipedia.comorg/staff/cohenwiki/ Danny_Cohen_(engineer) Danny Cohen], [httphttps://aien.isiwikipedia.eduorg/wiki/ U S CInformation_Sciences_Institute USC/I S IISI], April 1, 1980</ref> - almost every common processor has instructions to reverse the byte order of a word, a doubleword or a quadword inside a register, and there are applications to take advantage of that for a kind of reversed arithmetic, most notable as used inside the [[Hyperbola Quintessence]].
If we like to access the i-th byte of a quadword (e.g. a [[Bitboards|Bitboard]]), the following code is not endian-independent:
=External Links=
* [https://en.wikipedia.org/wiki/Endianness Endianness from Wikipedia]
* [https://www.ietf.org/rfc/ien/ien137.txt IEN 137 - DAV's Endian FAQ - On Holy Wars and a Plea for Peace] by [https://en.wikipedia.org/wiki/Danny_Cohen_(engineer) Danny Cohen], [https://en.wikipedia.org/wiki/Information_Sciences_Institute USC/ISI], April 1, 1980
* [https://developer.ibm.com/articles/au-endianc/ Writing endian-independent code in C] ''Don't let endianness "byte" you'' by Harsha Adiga, [https://developer.ibm.com/ IBM Developer], April 24, 2007

Navigation menu