delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/11/08:15:32

From: Paul Shirley <Paul AT chocolat DOT obvious DOT fake DOT foobar DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Infinite loop???
Date: Sat, 11 Jul 1998 12:24:31 +0100
Organization: wot? me?
Message-ID: <TLOCBFAvt0p1EwGO@foobar.co.uk>
References: <35A3D8C3 DOT 208E6D23 AT cyberdude DOT com> <35A5FC72 DOT C235F6D9 AT eik DOT bme DOT hu>
<VqrTZAA4qlp1Ew16 AT foobar DOT co DOT uk>
NNTP-Posting-Host: chocolat.foobar.co.uk
Mime-Version: 1.0
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

This is where I point out that I can't tell left from right, though it
normally does not cause a programming problems (Not major one ;)


In article <VqrTZAA4qlp1Ew16 AT foobar DOT co DOT uk>, Paul Shirley <Paul AT chocolat.
obvious.fake.foobar.co.uk> writes
>In article <35A5FC72 DOT C235F6D9 AT eik DOT bme DOT hu>, Dr. András Sólyom
><solyom AT eik DOT bme DOT hu> writes
>>For the left shift operator BCC uses an 
>>       SHL (shift left)
>>instruction, while GCC uses 
>>       SAL (arithmetic shift left)
>>I think these differ in how they uses the CARRY bit
>>
>>why is it so? 
>>       AFAIK the implementation of the left shift operator is left to the 
>>compiler
>>maker by the ANSI C specification.
>
>The >> operator is clearly defined. For signed operands it does an
>arithmetic shift, unsigned ops get a zero extending shift. If you see
>anything different its a compiler bug.

(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.
---
Paul Shirley: my email address is 'obvious'ly anti-spammed

- Raw text -


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