Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!killer!chasm From: chasm@killer.DALLAS.TX.US (Charles Marslett) Newsgroups: comp.arch Subject: Re: "big endian" and "little endian" - first usage for computer Summary: Are you sure about that Chris? Message-ID: <6605@killer.DALLAS.TX.US> Date: 31 Dec 88 02:44:10 GMT References: <2766@cbnews.ATT.COM> <10147@well.UUCP> <13045@cup.portal.com> <15209@mimsy.UUCP> Organization: The Unix(R) Connection, Dallas, Texas Lines: 33 In article <15209@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > In article <13045@cup.portal.com> bcase@cup.portal.com (Brian Case) writes: > >Big endian has the significant advantage that, when properly aligned, > >character strings can be compared using the full width of the machine's > >ALU. For 32-bit machines, this means that two four-character (sub)strings > >can be compared at one time. This is because the lowest address always > >points to the *first* character in the string. Little endian requires > >character-at-a-time processing or hardware gymnastics. > > This holds up for ordering comparisons (< <= > >=) only when the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > strings being compared are known to be sufficiently long, or are padded ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > with 0s (or something that compares < `normal' charactrers) to the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > machine's word length. For equality comparisons, the order of ^^^^^^^^^^^^^^^^^^^^^^ > subcomponents is irrelevant. Come now, are you saying that if I have two strings differing in the first character, the order they sort into can in any way be affected by later characters. The only case where the trailing trash can have an effect is if the two strings compare equal. Often equal compares are important, but often they are not, and full advantage can be taken of the system bandwidth in the big-endian system. On the other hand, if an easy way to identify the \0 byte is not available, faster compares does not help C code (usually). Other languages are almost all helped with this characteristic, though. (Is this because C was invented and developed in little-endian machines?) Charles Marslett chasm@killer.dallas.tx.us