Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!vrdxhq!bms-at!stuart From: stuart@bms-at.UUCP (Stuart D. Gathman) Newsgroups: comp.arch Subject: Re: Byte Order: On Holy Wars and a Plea for Peace Message-ID: <294@bms-at.UUCP> Date: Mon, 1-Dec-86 15:45:54 EST Article-I.D.: bms-at.294 Posted: Mon Dec 1 15:45:54 1986 Date-Received: Tue, 2-Dec-86 00:45:24 EST References: <1509@ihlpl.UUCP> <1335@hoptoad.uucp> <1364@hoptoad.uucp> Organization: Business Management Systems, Inc., Fairfax, VA Lines: 50 Summary: The real significance of Lilliput In article <1364@hoptoad.uucp>, gnu@hoptoad.uucp (John Gilmore) writes: > This order is very consistent with itself, with the Hebrew language, and > (more importantly) with mathematics, because significance increases with > increasing item numbers (address). > It has the disadvantage that English character streams appear to be > written backwards; this is only an aesthetic problem but, admittedly, it > looks funny, especially to speakers of English. The whole point of Little Endian arithmetic is that the digits are in the *opposite* order of text. The arabic numbering system, on which our numbers are based, was little endian. The english speaking world adopted it without reversing the order of the digits (arabic is written right to left), thus converting from little to big endian. The advantage of little endian is that variable length arithmetic proceeds from least significant to most significant. Do you remember wondering why sums had to be done right to left when everything else was left to right? Arab kids don't have this problem. Big endian arithmetic is less efficient for *variable* length numbers because of the initial step required to find the end of the number. For quantities handled in parallel by hardware (e.g. words), it makes no difference. Typical operations on variable length text (e.g. lexical ordering) are most efficiently performed when stored MSB first. Whether "stored first" means "lower machine address" is immaterial. If the machine provides for auto-decrementing through the data, it can be just as efficient. (But pointers that point to the *end* of an array are somewhat confusing if you're not used to it!) Conclusions: Little endian machines with big endian BCD are brain-damaged. Little endian machines with little endian strings are brain-damaged. Both big and little endian machines should provide variable length operations that can go either direction. This allows the software to decide whether the data is lexical or arithmetic. Both the 68000 and 80x86 do this. As for machine unit operations (words), they can mix and match to their hearts content: as long as they can print a one page reference that reminds me which bit/byte/word/float/etc is number 0/1. -- Stuart D. Gathman <..!seismo!dgis!bms-at!stuart>