delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/11/17:16:51

From: horst DOT kraemer AT snafu DOT de (Horst Kraemer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Infinite loop???
Date: Sat, 11 Jul 1998 21:15:36 GMT
Organization: Unlimited Surprise Systems, Berlin
Message-ID: <35a7c63e.12994149@news.snafu.de>
References: <35A3D8C3 DOT 208E6D23 AT cyberdude DOT com> <35A5FC72 DOT C235F6D9 AT eik DOT bme DOT hu><VqrTZAA4qlp1Ew16 AT foobar DOT co DOT uk> <TLOCBFAvt0p1EwGO AT foobar DOT co DOT uk> <Pine DOT SOL DOT 3 DOT 96 DOT 980711133217 DOT 25617C-100000 AT sol DOT sun DOT csd DOT unb DOT ca>
NNTP-Posting-Host: n31-170.berlin.snafu.de
Lines: 22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sat, 11 Jul 1998 13:37:00 -0300, Endlisnis <s257m AT unb DOT ca> wrote:

>On Sat, 11 Jul 1998, Paul Shirley wrote:
>->>>I think these differ in how they uses the CARRY bit
>->
>->(Having realised << is a left shift;)
>->The reason you see SAL or SHL is that they are the same instruction,
>->given 2 names at the whim of some Intel engineer, used at the whim of
>->the compiler writers.
>->The carry (if that were the difference) would be irrelevant since C
>->source cannot see a carry, compiler writers can do what they like with
>->it.
>	Wouldn't that mean that if you had a negative number shifted left
>a bunch of times you could end up with a positive?

Yes - and vice versa. Whenever the highest and second highest bits are
different, a  <<1 will change the sign. This situation is defined as a
signed integer overflow.

Regards
Horst

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019