---- START NEW MESSAGE --- Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-8.05) id A72013B2006C; Fri, 30 Jan 2004 18:46:56 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <9.00CC5A53@cherry.ease.lsoft.com>; Fri, 30 Jan 2004 21:16:41 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8e) with spool id 0513 for PICLIST@MITVMA.MIT.EDU; Fri, 30 Jan 2004 21:16:34 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 7811; Fri, 30 Jan 2004 21:15:04 -0500 Received: from tomts5-srv.bellnexxia.net [209.226.175.25] by mitvma.mit.edu (IBM VM SMTP Level 430) via TCP with SMTP ; Fri, 30 Jan 2004 21:15:04 EST X-Comment: mitvma.mit.edu: Mail was sent by tomts5-srv.bellnexxia.net Received: from amd1200 ([64.231.209.178]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with SMTP id <20040131021506.KWIS108.tomts5-srv.bellnexxia.net@amd1200> for ; Fri, 30 Jan 2004 21:15:06 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Fri, 30 Jan 2004 21:15:11 -0500 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: Herbert Graf Subject: Re: [PIC]: Hitech PICCLITE state machine optimization To: PICLIST@MITVMA.MIT.EDU In-Reply-To: <401A8392.10961.637A10C@localhost> Precedence: list X-RCPT-TO: Status: U X-UIDL: 371856625 > Herbert Graf wrote: > > > if ((ISR_state == 0 && ISR_charBuf == 'G') > > || (ISR_state == 1 && ISR_charBuf == 'F') > > || (ISR_state == 2 && ISR_charBuf == 'D') > > || (ISR_state == 3 && ISR_charBuf == 'V') > > || (ISR_state == 4 && ISR_charBuf == 'W') > > || (ISR_state == 5 && ISR_charBuf == 'H') > > || (ISR_state == 6 && ISR_charBuf == 'Y') > > || (ISR_state == 7 && ISR_charBuf == 'Z')) > > ISR_state++; > > > > Any idea how I might restructure my thinking or code to make this a > > little tamer? > > Make a constant array of 8 characters; initialize it with G, F, > D, V, W, H, Y, Z. Then: > > if (ISR_charBuf == array[ISR_state]) ISR_state++; > > -Andy WOW!!! 42 words saved thanks to that brilliant idea! :) Thanks alot. TTYL ---------------------------------- Herbert's PIC Stuff: http://repatch.dyndns.org:8383/pic_stuff/ -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body .