IsUnsigned() function?

Karl Heuer karl at haddock.ima.isc.com
Fri Jul 20 04:29:18 AEST 1990


In article <3539 at sactoh0.UUCP> jak at sactoh0.UUCP (Jay A. Konigsberg) writes:
>I would bet that they had something like this in mind.
>	#define MASK 10000000
>	signed(number) long number; {
>	    if(number & MASK) return(FALSE); else return(TRUE);
>	}

If that's what they had in mind, then `return (number >= 0)' is a trivial
solution-- which doesn't depend on the unspecified internal representation of
negative numbers, the number of bits in a long int, or remembering to specify
the correct radix for the bitmask.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list