Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.arch Subject: Re: 'big endian' and 'little endian' - first usage for computer Message-ID: <8409@aw.sei.cmu.edu> Date: 1 Feb 89 14:23:37 GMT References: <1840@lindy.Stanford.EDU> <2951@ficc.uu.net> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu (Robert Firth) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 15 In article <2951@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: >[deleted discussion about using sign bit on binary data for search > keys to distinguish them from strings in a bigendian database] > >You can't assume all characters in the character set are positive. EBCDIC >and ISO latin 1 violate this assumption. Um, I'd like to rephrase that. The character sets you mention use encodings between 0 and 255, which surely look positive. Indeed, if you ordered them by signed comparison, you'd go seriously wrong. I think the message is that the binary representation of a character should always be treated as unsigned; if you apply signed operations to it, you're wrong. Should it happen that all the characters in the set have a leading zero, you're wrong but lucky.