Careful, by using that method you risk adding TWO since if C is a one before the rlf it will shift the one in as well (causing a pretty tricky bug to find!). We can of course take advantage of this effect: bsf STATUS, C rlf ref, F This wll set C to one, and shift that in on the LSB. Of course this does not deal with overflow, as before. TTYL > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Nick Veys > Sent: Monday, June 03, 2002 00:52 > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Tine challendge shortest X -> 2X + 1 > > > rlf reg, f > incf reg, f > > Ignoring any possible overflow of course... > > nick@veys.com | www.veys.com/nick > > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Dmitriy A. Kiryashov > Sent: Sunday, June 02, 2002 3:39 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC]: Tine challendge shortest X -> 2X + 1 > > > Hi guys. Here is tiny challendge to warm up. ;) > > We have X variable. What is shortest possible > code to obtain 2X + 1 result back into X cell ? > > WBR Dmitry. > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.