www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/29/14:05:03

Message-Id: <m106JDO-000S2NC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: Seawolf <seawolf AT net4you DOT co DOT at>, djgpp AT delorie DOT com
Date: Thu, 28 Jan 1999 16:08:17 +0000
MIME-Version: 1.0
Subject: Re: Bitshifting
In-reply-to: <36B1EDB5.53C1FDCB@net4you.co.at>
X-mailer: Pegasus Mail for Windows (v2.54)
Reply-To: djgpp AT delorie DOT com

Seawolf <seawolf AT net4you DOT co DOT at> wrote:

> 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

Because ints are 32 bits in djgpp and 16 in BC (value is int so the 
operations are made with ints, not long)

SET 
------------------------------------ 0 --------------------------------
Visit my home page: http://welcome.to/SetSoft
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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