delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/04/23/14:00:04.1

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Error trying to Shift Longs & LongLong
Date: Wed, 23 Apr 2003 18:40:35 +0100
Lines: 28
Message-ID: <3EA6D013.8176C95F@phekda.freeserve.co.uk>
References: <l4jdavgfk12obr35dfrs0oqtahdthcfhcu AT 4ax DOT com>
NNTP-Posting-Host: 62.136.9.90
Mime-Version: 1.0
X-Trace: newsg3.svr.pol.co.uk 1051120786 8529 62.136.9.90 (23 Apr 2003 17:59:46 GMT)
NNTP-Posting-Date: 23 Apr 2003 17:59:46 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Radical, NetSurfer wrote:
> 
> The program below works 100% correctly in Borland,
> but produces one very obvious problem when run from
> DJGPP.....
> 
>     x = (1 << m);
> 
> why should shifting by a (-1) create such an unsual value?
> 
> Shouldn't shifting by "all" bits give Zero ?
> 
> Why is the "sign-bit" apparently being shifted into things?
> 
> Long Long appears to be a special contrivance, so we're not
> too concerned about their artificial behavior.
> 
> Comments welcomed!
[snip]

So what results do you actually get? Describe it, e.g.: 1 << 1 gives 2.

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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