IsUnsigned function? [A solution which almost works!]

Mark Lanzo lanzo at wgate.UUCP
Thu Jul 26 23:17:38 AEST 1990


My boss thought this one up:

	#define IsUnsigned(x) (!( (x) < 0 || (-(x) < 0) ))

This will work, as long as "x" is a nonzero value.

At least this one tries to answer the actual question "Is it unsigned?" and
not "is it negative?" or "is the m.s.b. set?" ...


-- 
Mark Lanzo                      Wandel & Goltermann Technologies, Inc.
Home (919)481-2406              1030 Swabia Court
Play (919)941-5730              Research Triangle Park
uunet.uu.net!wgate.com!lanzo    North Carolina 27709-3585



More information about the Comp.lang.c mailing list