Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uxe.cso.uiuc.edu!mcdonald
From: mcdonald@uxe.cso.uiuc.edu
Newsgroups: comp.lang.c
Subject: Re: What's Wrong here?
Message-ID: <47000024@uxe.cso.uiuc.edu>
Date: Wed, 2-Dec-87 09:24:00 EST
Article-I.D.: uxe.47000024
Posted: Wed Dec  2 09:24:00 1987
Date-Received: Sun, 6-Dec-87 23:44:24 EST
References: <278@westmark.UUCP>
Lines: 28
Nf-ID: #R:westmark.UUCP:278:uxe.cso.uiuc.edu:47000024:000:616
Nf-From: uxe.cso.uiuc.edu!mcdonald    Dec  2 08:24:00 1987


/* Written  6:37 pm  Nov 30, 1987 by jru@etn-rad.UUCP in uxe.cso.uiuc.edu:comp.lang.c */
negative after the shift. Microsoft C uses the arithmetic shift whenever 
you do a >> shift in C. This is nice in a way, because a right shift by 
/* End of text from uxe.cso.uiuc.edu:comp.lang.c */

Only on signed quantities. Consider this C subroutine and the compiler output
(dead code deleted):

a(b,c)
int b;
unsigned c;
{
   b >>= 1;
   c >>= 1;
}

_a	PROC NEAR
	push	bp
	mov	bp,sp
	sar	WORD PTR [bp+4],1	;b    sar is arithmetic
	shr	WORD PTR [bp+6],1	;c    shr is logical
	mov	sp,bp
	pop	bp
	ret	
a	ENDP

Doug McDonald