Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!crowl From: crowl@rochester.ARPA (Lawrence Crowl) Newsgroups: comp.arch Subject: Re: Byte Order: On Holy Wars and a Plea for Peace Message-ID: <22846@rochester.ARPA> Date: Wed, 3-Dec-86 14:54:43 EST Article-I.D.: rocheste.22846 Posted: Wed Dec 3 14:54:43 1986 Date-Received: Wed, 3-Dec-86 22:12:22 EST References: <1509@ihlpl.UUCP> <1335@hoptoad.uucp> <1364@hoptoad.uucp> <399@viper.UUCP> <228@watcgl.UUCP> <12250@watnot.UUCP> Reply-To: crowl@rochester.UUCP (Lawrence Crowl) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 38 In article <12250@watnot.UUCP> ccplumb@watnot.UUCP (Colin Plumb) writes: >Some people have argued that little-endian byte order is better for multi- >precision arithmetic. I don't think this is true. If you're only using >a few bytes, you add the low bytes, and then add the high bytes - with no >change in efficiency for either order. What if you do not know the length ahead of time? This case would arise when the number is stored as a linked list of groups of bits. What if the lengths are not equal? This case would arise when each number occupies a single region of memory, but each has different size. With this strategy, if you work from the high end down, you must manufacture high order zeros until you reach the data for the shorter number. >But if you need to use a loop to do the addition, on the vast majority of >CPU's it's quicker to start at the highest address and go down to zero, >saving a comparison each time 'round the loop. (Of course, if you're >counting from a to b, neither of which are zero, then you have equality >again.) I believe you are assuming indexing in accessing the component words. This is not near as efficient as using pointers. When you use pointers, you can decrement the count towards zero while incrementing the pointers. This means that we can use the efficient comparison to zero as opposed to the less efficient comparison to n. Note that even in your statement above, the comparison was not saved, it was changed to a different flavor. With this pointer appoach, incrementing the pointers through memory is just as fast as decrementing pointers through memory. >Thus big-endian order is better. Since your equal case is actually in favor of little-endian, and your case in favor of big-endian is actually equal, little-endian is better for multi-precision arithmetic. -- Lawrence Crowl 716-275-5766 University of Rochester crowl@rochester.arpa Computer Science Department ...!{allegra,decvax,seismo}!rochester!crowl Rochester, New York, 14627