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> NNTP-Posting-Host: n31-170.berlin.snafu.de Lines: 22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Sat, 11 Jul 1998 13:37:00 -0300, Endlisnis 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