Path: utzoo!attcan!uunet!husc6!think!ames!elroy!cit-vax!mangler From: mangler@cit-vax.Caltech.Edu (Don Speck) Newsgroups: comp.arch Subject: Re: negative addresses (really unsigned arithmetic) Summary: efficiency tricks Message-ID: <6575@cit-vax.Caltech.Edu> Date: 17 May 88 08:32:54 GMT References: <2393@uvacs.CS.VIRGINIA.EDU> <9485@apple.Apple.Com>, <1988May15.220044.12987@utzoo.uucp> Organization: California Institute of Technology Lines: 10 One should use unsigned numbers when mixing arithmetic and logical operators, e.g. division by shifting right, modulus by masking, etc. There are certain optimizations along those lines that are only safe if the compiler can be sure that the number cannot be negative (stemming largely from the convention of rounding towards zero). Array indices can be range-checked with a single unsigned compare. Don Speck speck@vlsi.caltech.edu {amdahl,ames!elroy}!cit-vax!speck