From: Dave Bird Newsgroups: comp.os.msdos.djgpp Subject: Re: Bitshifting Date: Fri, 29 Jan 1999 18:23:41 +0000 Organization: very little Message-ID: 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 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 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