Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!seismo!brl-tgr!ron
From: ron@brl-tgr.ARPA (Ron Natalie )
Newsgroups: net.lang.c
Subject: Re: How does one construct a mask for th
Message-ID: <8998@brl-tgr.ARPA>
Date: Wed, 6-Mar-85 12:05:14 EST
Article-I.D.: brl-tgr.8998
Posted: Wed Mar  6 12:05:14 1985
Date-Received: Fri, 8-Mar-85 03:42:19 EST
References: <377@haddock.UUCP>
Organization: Ballistic Research Lab
Lines: 13

> >> /*
> >> This would require generation of a mask for the most significant bit
> >> */
> 
> #define MSB (~(-1>>1))
> 
Surprise, this doesn't even work on VAX's and PDP -11's.  -1>>1 is still
-1.  Be careful when coming up with ideas like these.  C has also been
implemented on ones-complement (and subtractive arithmatic) machines.
Right shifting of signed quantities is defined to be machine depenedant
in C.

-Ron