Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!pyrdc!netxcom!sdutcher
From: sdutcher@netxcom.UUCP (Sylvia Dutcher)
Newsgroups: comp.lang.c,comp.sys.ibm.pc
Subject: Re: What's Wrong here?
Message-ID: <549@netxcom.UUCP>
Date: Wed, 2-Dec-87 17:08:05 EST
Article-I.D.: netxcom.549
Posted: Wed Dec  2 17:08:05 1987
Date-Received: Sat, 5-Dec-87 17:23:07 EST
References: <278@westmark.UUCP> <6755@brl-smoke.ARPA>
Reply-To: sdutcher@netxcom.UUCP (Sylvia Dutcher)
Lines: 26
Xref: mnetor comp.lang.c:5693 comp.sys.ibm.pc:10730


I have checked a couple pf references and have found the following defenitions.

ARITHMETIC SHIFT - An arithmetic shift is a microoperation that shifts a 
*signed* binary number to the left or right.  An arithmetic shift-left
multiplies a signed binary number by 2.  An arithmetic shift-right divides
the number by 2.  Arithmetic shifts must leave the sign of the number 
unchanged because the sign of the number remains the same when it is 
multiplied or divided by 2.  (Mano, Digital Logic and Computer Design, p329)

LOGICAL SHIFT - A shift operation with 0 inserted in the extreme bit is
considered a logical shift microoperation. (Ibid, p339)

Just to confuse things, Kernighan & Ritchie say (p45)
" ... x << 2 shifts x left by two positions, filling vacated bits with 0;
this is equivalent to multiplication by 4.  Right shifting an *unsigned*
quantity fills vacated bits with 0.  Right shifting a signed quantity will
fill with sign bits ("arithmetic shift") on some machines .....and with
0-bits ("logical shift") on others.

So I guess you're all right!
-- 
Sylvia Dutcher
NetExpress Communications, Inc.
1953 Gallows Rd.
Vienna, Va. 22180