All in all, not too bad, considering it is a generic routine that creates that code. TTYL > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of John Dammeyer > Sent: Tuesday, June 04, 2002 12:11 > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Tine challendge shortest X -> 2X + 1 > > > >From the Bytecraft C > > 08D9 1003 BCF STATUS,C i = i*2+1; > > > MPC "C" COMPILER V1.40 24-Jul-2000 > PAGE 89 > > > 08DA 0D4D RLF 4D,W > 08DB 00FE MOVWF 7E > 08DC 0A7E INCF 7E,W > 08DD 00CD MOVWF 4D > > John Dammeyer > > > > Wireless CAN with the CANRF module. > http://www.autoartisans.com/documents/canrf_prod_announcement.pdf > Automation Artisans Inc. > Ph. 1 250 544 4950 > > > > -----Original Message----- > > From: pic microcontroller discussion list > > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Scott Dattalo > > Sent: Tuesday, June 04, 2002 7:04 AM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: Re: [PIC]: Tine challendge shortest X -> 2X + 1 > > > > > > On Mon, 3 Jun 2002, Dmitriy A. Kiryashov wrote: > > > > > 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 ? > > > > > > > How about: > > > > sdcc -S -mpic14 c.c > > > > ... > > > > ;; Unrolled 8 X 8 multiplication > > ;#CSRC c.c 71 > > ; achar0 = achar0*2 + 1; > > MOVF _achar0,W ;key=000,flow seq=001 > > MOVWF r0x20 ;key=001,flow seq=001 > > ADDWF r0x20,F ;key=002,flow seq=001 > > CLRF r0x21 ;key=003,flow seq=001 > > RLF r0x21,F ;key=004,flow seq=001 > > INCF r0x20,W ;key=005,flow seq=001 > > MOVWF _achar0 ;key=006,flow seq=001 > > > > I think I hate C compilers. :) > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > > > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body