Date : Mon, 18 Jul 1994 12:30:27 EST
From : Stephen Quan <quan@...>
Subject: x & 0x80
Hi I was looking at some assembly output from C code, and
found that if you want to check if a number is negative
if (X & 0x80)
Then the best test for better assembly performance code is :
if ( ((char) X) < 0 )
if you do it this way, then your compiler will make use of it's
condition codes to check whether X is negative rather than doing a
compare with 0x80. Hope this helps!
--
Stephen Quan (quan@... ), SysAdmin, Analyst/Programmer.
Centre for Spatial Information Studies, University of Tasmania, Hobart.
GPO BOX 252C, Australia, 7001. Local Tel: (002) 202898 Fax: (002) 240282
International Callers use +6102 instead of (002).