Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: IsUnsigned() function? Message-ID: <17125@haddock.ima.isc.com> Date: 19 Jul 90 18:29:18 GMT References: <1990Jul16.214155.5087@Neon.Stanford.EDU> <3539@sactoh0.UUCP> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 13 In article <3539@sactoh0.UUCP> jak@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@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint