www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/29/15:38:46

From: Dave Bird <dave AT xemu DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bitshifting
Date: Fri, 29 Jan 1999 18:23:41 +0000
Organization: very little
Message-ID: <a4$UbmAtyfs2EwxV@xemu.demon.co.uk>
References: <36B1EDB5 DOT 53C1FDCB AT net4you DOT co DOT at>
NNTP-Posting-Host: xemu.demon.co.uk
X-NNTP-Posting-Host: xemu.demon.co.uk:158.152.196.209
X-Trace: news.demon.co.uk 917640953 nnrp-11:10242 NO-IDENT xemu.demon.co.uk:158.152.196.209
X-Complaints-To: abuse AT demon DOT net
MIME-Version: 1.0
X-Newsreader: Turnpike (32) Version 4.01 <dQumtnY$x4rJ2u5tL5fS$n2vuP>
Lines: 25
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <36B1EDB5 DOT 53C1FDCB AT net4you DOT co DOT at>, Seawolf
<seawolf AT net4you DOT co DOT at> writes
>Why does this code work with DJGPP but not with Borland C 3?
>
>int value = 0x000F;
>unsigned long c;
>
>c = value + (value<<8) + (value<<16) + (value<<24);
>
>DJGPP produces the correct 0x0F0F0F0F.
>But Borland C 3.1 only does the last two bytes: 0x00000F0F

 Your EARLY version of Borland thinks that int is 16 bits signed,
 long is 32 bits signed.  

 Your problem will be fixed if you do   unsigned long  value=0x000F;


 It is not true that this is a problem with Borland GENERALLY:
 if you upgrade to version five,  ints are 32 bit.

-- 
   ^-^-^-@@-^-;-^   http://www.xemu.demon.co.uk/
        (..)__u     news:alt.smoking.mooses

- Raw text -


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