[comp.lang.c] IsUnsigned function? A solution which almost works!

lanzo@wgate.UUCP (Mark Lanzo) (07/26/90)

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