From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: converting 2 numbers into one Date: Mon, 05 Oct 1998 12:09:35 -0700 Organization: Alcyone Systems Lines: 24 Message-ID: <3619196F.5B47FBF1@alcyone.com> References: <3618B080 DOT ED38C4C AT cdworld DOT co DOT uk> NNTP-Posting-Host: charmaine.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.34 i686) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Craig Rothwell wrote: > turn '11111111' and '00000000' > (as 2 variables) > > into '1111111100000000'? (as one > variable) Use the left shift and bitwise or operators: unsigned char h, l; ... unsigned short hl = (h << 8) | l; -- Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/ USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE \ / History is a bucket of ashes. / Carl Sandburg