Path: chuka.playstation.co.uk!news From: Craig Graham Newsgroups: scee.yaroze.freetalk.english Subject: Re: Square Root Date: Fri, 21 Aug 1998 18:25:08 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 36 Message-ID: <35DDAD74.CBCD107B@hinge.mistral.co.uk> References: <35DD914A.BBA25235@ndirect.co.uk> <35DD9B1E.3FEAA1E5@scee.sony.co.uk> NNTP-Posting-Host: d1-s11-43-telehouse.mistral.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Alternatively, if all you want is the length of a vector, the manhattan distance approximation: inline short manhatan_distance(register unsigned short a, register unsigned short b, register unsigned short c) { register short t; if(a b { t=a; a=b; b=t; } if(b c { t=b; b=c; c=t; } if(a b { t=a; a=b; b=t; } // t=a + (b>>2) + (c>>2); // faster lower accuracy t=a + ((11*b)>>5) + (c>>2); // slower, more accurate return t; }