Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Seawolf , djgpp AT delorie DOT com Date: Thu, 28 Jan 1999 16:08:17 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT 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 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